This will be moved to Bragi once it settles, since it concerns protocol formats/giving shape to messages.
The generic type COMPONENT_NAMES can be used to restrict the possible component names. At heart, it is just a string
(and it's fully valid to create a Logger<string>), but to enforce consistency, you can implement it as a union type
of specific strings, e.g. Logger<'network' | 'login' | 'unknown'>.
This will be moved to Bragi once it settles, since it concerns protocol formats/giving shape to messages.
The generic type
COMPONENT_NAMES
can be used to restrict the possible component names. At heart, it is just a string (and it's fully valid to create aLogger<string>
), but to enforce consistency, you can implement it as a union type of specific strings, e.g.Logger<'network' | 'login' | 'unknown'>
.