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
Proposed Logger rework to fix issue 728 #736
Conversation
Some other loggers do not have a logstream and do not fit into 'rack.errors'
Colorize allows to add Padrino message colorization to any logger that is annotated with LoggingExtensions.
colorize now returns the colorized string, not the original.
Allows to annotate other loggers with padrino fancyness
This ensures that the logger actually supports colorization
format_message is used by ruby stdlib logger
Looks great, thanks for putting this together. @DAddYE can you review this and merge it since you've played with logging the most? |
How about this one? I would really like to deploy Lumberjack in production. |
I agree @DAddYE Can you review and merge this before the release? |
No reason to apologize :). But skipping one revision would be more work for everyone. |
Proposed Logger rework to fix issue 728
Thanks @skade I will re-couple into a single module to keep things more readable, btw awesome refactoring! Thanks so so much! |
Hi,
this evolved into a larger patch then intended, but hopefully satisfies all parties. I tried to refactor the Padrino Logger so that all the fancy stuff @DAddYE built is still working and - as an added bonus - can be added to other loggers as well. This works by splitting the logger implementation into 2 modules for proper extensions (like the #bench method for benchmarks and the #devel log level) and one for colorization (as some loggers, like syslog, cannot handle colors). Extensions are always added to any logger that is passed to #logger=, Colorization is only added on the users request. Example:
Also, I took the liberty of adding all those modules to a
Padrino::Logging
submodule, while keepingPadrino::Logger
as is.This pull request also adds tests using Lumberjack and the ruby stdlib Logger as examples.
Merry Christmas, by the way.
Best regards,
Florian