Skip to content

Some example outputs for the documentation #36

@FichteFoll

Description

@FichteFoll

Context: I am looking to migrate our internal logging utility that was based on <2.0.7 to 3.x. I initially wanted to request some example outputs, but as I continued to read the docs, I wrote down more questions that I couldn't (immediately) answer by reading them.


First of all, thanks for continuing development & maintenance of this library.

In the entire documentation, there is only a single example currently where the output of python-json-logger is mentioned: On the landing page. It would be nice to see the outcomes of some of the examples directly in the docs to get a better understanding of what the various options and usage patterns result in. Especially the examples for defaults and static_fields on the Quick Start page could use some expected result examples to better explain their behavior on the emitted log message.

On that topic, I'd also be interested in the exact interactions of static_fields with defaults and per-record extras, because unless extra is forbidden from overriding static_fields, I don't see a difference between defaults and static_fields currently. rename_fields might make a difference here, but I don't see the use case for that either if all parameters can be fully controlled by the user.

Furthermore, the docs example for "Default Fields" uses extras for the log record argument where I believe it should be extra, but I have not verified that.

We use add_fields to override the emitted log fields for each record, e.g. to add a severity level and a timestamp. I suspect this to be a quite common use case for the JSON formatter, so it should be added to the Cookbok page imo.

Finally, a migration guide when coming from version <3.0.0 would be neat, though since the old API was basically maintained, probably not necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationuser supportSomeone needs help with using the library

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions