Dragon2fly/logger_tt

Any guidance on adding a custom formatter?

Opened this issue · 1 comments

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?

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