Skip to content
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

Any guidance on adding a custom formatter? #20

Open
rileyjenk opened this issue Jan 13, 2023 · 1 comment
Open

Any guidance on adding a custom formatter? #20

rileyjenk opened this issue Jan 13, 2023 · 1 comment

Comments

@rileyjenk
Copy link

The changelog indicates that custom fields may be added. Ideally we would like to use the https://github.com/madzak/python-json-logger format.

Do you have an example of adding an external formatter rather than the basic format parameter options?

Do you have an example of setting the formatter so that it will extract certain fields if they exist?

@Dragon2fly
Copy link
Owner

Dragon2fly commented Jan 16, 2023

Hi @rileyjenk

I don't have any examples right now. But you can just add your custom formatter to the config file as usual.
That means you could use any formatter provided by third-party lib.
If you need more help, please also provide your formatter, code example, and expected output.

formatters:
    myFormatter:
      '()': The.import.path.of.your.Formatter

handlers:
  console:
    class: logging.StreamHandler
    level: INFO
    formatter: myFormatter
    stream: ext://sys.stdout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants