severb / graypy

Python logging handler for Graylog that sends messages in GELF (Graylog Extended Log Format).
https://www.graylog.org/
BSD 3-Clause "New" or "Revised" License
260 stars 91 forks source link

add ability to apply a logger.Formatter to a GLEF logs `short_message` and `long_message` #89

Closed nklapste closed 5 years ago

nklapste commented 6 years ago

Adds the ability to specify a python logging.Formatter within the initialization of a BaseGELFHandler or its children. This allows the logging.Formatter to be applied to the GELF log's short_message and long_message.

Small refactoring and modernization of the python codebase was also done.

severb commented 6 years ago

Nathan, can you please rebase on top of the latest master? I already merged the cleanup part.

nklapste commented 6 years ago

Nathan, can you please rebase on top of the latest master? I already merged the cleanup part.

Sure I can start some updates on this branch. It should be done by the end of this week.

nklapste commented 6 years ago

I ended up changing the way to set the formatter to use a setFormatter method in the base class BaseGELFHandler. This seems cleaner and resembles how other python logging handlers work.

Please review and see if this specification is preferable.

It may be beneficial in the future to make BaseGELFHandler a subclass of logging.Handler as to fully encompass all python logging handler behavior.

nklapste commented 6 years ago

Also note this does not raise the version number of graypy. I would recommend v0.4.0.

nklapste commented 6 years ago

Nathan, can you please rebase on top of the latest master? I already merged the cleanup part.

Sure I can start some updates on this branch. It should be done by the end of this week.

Should be rebased and revised! Feel free to review and merge when comfortable!

nklapste commented 6 years ago

@severb any ETA on review and merging?

severb commented 5 years ago

Sorry for the lag on my side. Thanks for the patch!