Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
chore: Add logger package for node server side apps #6188
chore: Add logger package for node server side apps #6188
Changes from 3 commits
aea213b
821a994
e503599
df0fc65
62d1a51
c9d0a02
df66e92
9047adf
739e15f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
donot create a build for this package. You can directly import them and use it. Let the application that is using it transpile these packages.
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.
🛠️ Refactor suggestion
Singleton pattern may ignore subsequent
logLevel
changesThe
getInstance
method initializes the logger only once. Subsequent calls togetLogger
with a differentlogLevel
will not update the log level of the existing logger instance, which may lead to unexpected behavior if different log levels are specified later.Consider modifying the implementation to allow updating the log level dynamically or document that the log level is set only during the first initialization.
Apply this diff to update the logger's level if a new
logLevel
is provided: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.
Mixing ES modules and CommonJS
require
statementsThe code uses
require
statements in a module that usesimport
statements. This can lead to compatibility issues, especially when using TypeScript with ES module syntax. Consider using dynamicimport()
for conditional imports.Apply this diff to replace
require
with dynamic imports:Alternatively, ensure that the module system is consistent throughout the project.
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.
convert those log level and log file prefix as entities inside an object.
Basically constructor will take a object, you destruct it and use it.
By doing this like and server logger can be initialised with same type of object.
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.
🛠️ Refactor suggestion
Singleton pattern may ignore subsequent
logLevel
andlogFilePrefix
changesThe
getInstance
method initializes the logger once. Subsequent calls togetLogger
with differentlogLevel
orlogFilePrefix
will not update the existing logger instance, which may cause unexpected behavior if these parameters are changed later.Consider modifying the implementation to handle dynamic updates to
logLevel
andlogFilePrefix
or document that these parameters are set only during the first initialization.Apply this diff to update the logger's configuration if new parameters are provided:
Note: Updating the
logFilePrefix
may require recreating the transport to apply the new file naming convention.