-
Notifications
You must be signed in to change notification settings - Fork 7
refactor: promote logger to its own package #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
0515527 to
2f60400
Compare
2f60400 to
2a76d18
Compare
rekmarks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Some questions / suggestions.
| /** | ||
| * Parses the options for the logger. | ||
| * | ||
| * @param options - The options for the logger. | ||
| * @returns The parsed options. | ||
| */ | ||
| export const parseOptions = ( | ||
| options: LoggerOptions | string | undefined, | ||
| ): LoggerOptions => { | ||
| // The default case catches whatever is not explicitly handled below. | ||
| // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check | ||
| switch (typeof options) { | ||
| case 'object': | ||
| return options; | ||
| case 'string': | ||
| return { tags: [options], transports: [consoleTransport] }; | ||
| case 'undefined': | ||
| return { transports: [consoleTransport] }; | ||
| default: | ||
| throw new Error('Invalid logger options'); | ||
| } | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are a lot of options. We could just use an options bag instead. Does not need to be actioned in this PR.
3f43248 to
8969312
Compare
rekmarks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some conflicts snuck in but otherwise LGTM!
a5c5845 to
076e45c
Compare
rekmarks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Refs: #217
@ocap/loggerpackageLoggerclass from@ocap/utilsto@ocap/loggermakeLoggercalls withnew Loggerin refactored packagesmakeLoggerfactory from the monorepo