Feature Request: Configurable message padding
JoshTGreenwood opened this issue · 1 comments
Describe the problem
I'd like to be able to configure the message padding in the console handler to something slightly higher so that my messages can exceed 25 characters and my first field will line up without pushing to the right.
I believe this is the line in question: https://github.com/piotrmurach/tty-logger/blob/master/lib/tty/logger/handlers/console.rb#L121
I'd like to be able set that padding to say, 50 characters, or something I know will fit all my messages.
Steps to reproduce the problem
require 'tty/logger'
logger = TTY::Logger.new(fields: {foo: :bar})
logger.info "short"
logger.info "longer message here"
logger.info "this is a really long message and will push my fields right"
outputs the following:
Actual behaviour
The first field gets pushed to the right on messages > 25 characters
Expected behaviour
I'd like the label of the first field to remain aligned for more messages
Describe your environment
- OS version: Mac OSX
- Ruby version: 2.7.1
- TTY::Logger version: 0.4.0
I'd be happy to open a PR if you're open to this changing.
Hi Josh 👋
Sorry for not replying sooner. I do rely on GitHub issues inbox notifications and I never received anything for this.
I'm 💯 to allow custom padding configuration. The 25 characters seemed like a reasonable default but hardly a solution that will fit everyone's needs. So please submit PR with a test case!