-
Notifications
You must be signed in to change notification settings - Fork 145
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
Logger pretty newlines #320
base: dev
Are you sure you want to change the base?
Logger pretty newlines #320
Conversation
libs/utils/Logger.lua
Outdated
line[5] = gsub( | ||
line[5], | ||
'\r?\n', | ||
'%0' .. rep(' ', #line[1] + 16 - 2) .. '| ' -- Timestamp + label (10) + separators (6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show where you get 16 from? We probably shouldn't hardcode this if it can be dynamically generated (maybe as a module local value).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The label (line[3]
) is always length 10. The two separators (|
) (line[2]
and line[4]
) are both 3, so 6 total.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably shouldn't hardcode this if it can be dynamically generated (maybe as a module local value).
Can you make this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this?
75018a4
This pull request adds a new
boolean
client optionprettyNewlines
(true
by default) and a newLogger
option + mutators which, whentrue
, makes the logger pad newlines so that they align with the timestamp label. This is just a cosmetic change to make logging multi-line strings neater.As an example, what before was:
now becomes: