-
Notifications
You must be signed in to change notification settings - Fork 0
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
Integrate optional trace in order to easily identify where logs are being outputted #4
Comments
So I imagine that when
We may need to add a formatting override parameter to our logger:
Furthermore we can expand the symbols to be functions which can allow us to parameterise what we want to do:
Note that the This does mean that our "human readable" log messages are not always terminated by a newline. Because it may have newlines inside a single message. This will cause issues for downstream log analyzers, because most are pretty simple and just parse messages by newlines. But this |
This adds a stack trace formatted the same way as an error message. This will allow us to debug where logging messages are coming from. Related #4
Added the ability to override a log message format on a per-message basis. You have to provide an optional `LogFormatter` parameter to the message. For example logger.info('INFO MESSAGE', formatting.format`${formatting.date}:${formatting.msg}`);. Related #4
Added the ability to override a log message format on a per-message basis. You have to provide an optional `LogFormatter` parameter to the message. For example logger.info('INFO MESSAGE', formatting.format`${formatting.date}:${formatting.msg}`);. Related #4
Added the ability to override a log message format on a per-message basis. You have to provide an optional `LogFormatter` parameter to the message. For example logger.info('INFO MESSAGE', formatting.format`${formatting.date}:${formatting.msg}`);. Related #4
Added the ability to override a log message format on a per-message basis. You have to provide an optional `LogFormatter` parameter to the message. For example logger.info('INFO MESSAGE', formatting.format`${formatting.date}:${formatting.msg}`);. Related #4
Specification
Sometimes we get logging messages where we don't know where they came from, and it would be nice to know how the code arrived at that execution point.
The
console.trace()
can immediately show a trace of where you are.But it prints to stdout, and we would want it as a variable. The
Error.stack
property seems to be something we can use. https://stackoverflow.com/a/36172532/582917This trace string can then be part of the logged out information, which would make it easier to find out where a particular log message is occurring.
Adding it into the formatting however can make logs VERY noisy. Which would rely on #3 to help decipher.
Additionally we can add "custom formatting" override to the logging method
logger.info
which can help us to interactive debugging.Note that enabling traces would be quite expensive.
Tasks
trace
keywordlogger.info
and related methodsThe text was updated successfully, but these errors were encountered: