-
Notifications
You must be signed in to change notification settings - Fork 146
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
Feature request: output text of the message in addition to log keys and values in the log #666
Comments
(I'm not a maintainer of this repo. Just giving my 2-cents)
|
This can be accomplished by passing a message as the first argument and the object currently being logged as the second argument when calling a console.log type function. In the v0.7.1 implementation, this part should be as follows
If it is okay with this change, I would like to submit a pull request. |
Hello @lulzneko, thanks for the interest in the project and for taking the time to open an issue & offering to open a PR for your proposal. We consider JSON-structured logging as one of the key features of Logger and while we appreciate your offer of contributing, we won't be going in that direction for the time being. While having human-readable output adds value during the initial development phases, unstructured logs can be difficult to interpret and analyze programmatically. Values may appear in these logs arbitrarily, and the format may change over time. On the other hand, applications that implement structured logging, lead to an easier path towards monitoring in production systems. This is in line with the best practices discussed in the AWS Lambda documentation. Apart from the general benefits of structured logs in JSON, many customers send their CloudWatch logs in a company-wide centralised monitoring tool like Logz.io and Datadog; for this reason it's important the logs produced by Powertools are valid JSON logs that can be correctly parsed by 3rd party vendors, not only CW. With that said, I see where you're coming from and I can relate on the fact that during development, logging structured as JSON might be a bit too verbose. For those cases you I would suggest (and I personally use) the CloudWatch Insights as mentioned by @orozcoadrian with a query similar to this one (the image below shows how it would look):
I'm going to close the issue, but if you're still interested to contribute to the project I would encourage you to engage with one of the other items labeled as |
|
Description of the feature request
The current log output shows the context and additional keys and values.
The message text passed to the logger is stored in the
message
of the keys and values and is logged as part of the object.This
message
should be logged as text, not just as part of the object output in the log.Problem statement
The
message
that should be read first in the log is hidden behind the object and cannot be read immediately.The current log is displayed in CloudWatch Logs as follows
Summary of the feature
The
message
passed in the log output function is added to the log object and displayed as text.Code examples
No change in developer.
The above log output code will be output to CloudWatch Logs as follows
The
message
passed to the logger will be output after the log level in CloudWatch Logs.Of course, the
message
of subsequent objects will be output as before.The only difference is that the message text is added after the log level.
Benefits for you and the wider AWS community
Improves readability of logs in CloudWatch Logs.
This will facilitate operations and debugging.
Describe alternatives you've considered
Additional context
Related issues, RFCs
The text was updated successfully, but these errors were encountered: