-
Notifications
You must be signed in to change notification settings - Fork 29
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
Centralized logger implementation #53
base: master
Are you sure you want to change the base?
Conversation
Better separation between configuration and the logger interface Combination and filtering of logging contexts Single message type replaced with multiple tags Multiple parameters of primitive and record types for message body An interface for logging custom objects Improved ergonomics for one time logging
Updated unit test and documentation.
filtering disabled in example app.
Summary of recent updates. SDK user facing changes: SDK developer facing changes: Regarding string and regexp filtering, I realized that the behavior would be context dependent. For example currently the console context just forwards parameters to the dev console, without ever combining them to a single string to apply a string filter to. Also even just conceptually for example the log level is not represented as text there, while it would be if logging to a file, which would change the behavior of such filters between these two contexts. So if we ever want to use this code for a user facing GUI log with string/regexp filter, we'll need to implement an appropriate context, which will itself provide the filtering functionality in whichever way it would make the most sense there. |
|
The Log object is meant to be used for logging purposed in the SDK, to replace all the current and future console logs. Similar to console it provides a logging function per level (debug, message, info, warning, error), and additionally a function that accepts a
For structured filtering purposes in addition to log level the logger also implements tagging.
The tag function accepts a list of strings returns a new logger instance that will include those tags with every message logged. If the given set of tags is used often, the new logger instance can be reused to avoiding repeating the tags.
Specifically to resolve #45 the logger implements prevention of duplicate messages, also using method chaining:
For completeness there is a The Log object is instantiated with |
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.
Suggested changes fix npm run lint
errors.
Additionally, npm run test .unit.
fails with error:
TypeError: [console.debug,console.log,console.info,console.warn,console.error].at is not a function
I have tested with this PR and have had no problems. I approve this PR |
Ping! This does not merge into the master branch any more. Changes are needed. |
I believe David is adjusting it. |
Yes, I'm looking at this. It will need some further work (to be determined) before being merged. |
used minimally just to solve #45