-
Notifications
You must be signed in to change notification settings - Fork 650
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
Add param for indent size to LogRecord.to_json() #2870
Add param for indent size to LogRecord.to_json() #2870
Conversation
I just want to call out couple of things based on your usage. The |
Thank you for the call out! If the console exporter gets dropped, is it safe to assume that |
Maybe, but we do not guarantee anything about logs SDK. |
@dougramirez please fix the conflicts in this PR |
Description
This change will allow callers to the LogRecord.to_json() func to specify an
indent
. Previously the func used4
as theindent
. The consequences of that hard coding meant that log records were being emitted on > 1 line.This PR will allow callers to send
None
to the func, which allows the LogRecord to be emitted on a single line. This has the benefit of allowing downstream consumers to read the log as single line and index its keys for queries.The example below shows how this can be leveraged by sending the
indent
level as a param to the LogRecord.to_json() func as part of a formatter to the exporter.This addresses an issue previously documented here: Single log line
logs.py
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: