-
Notifications
You must be signed in to change notification settings - Fork 152
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
LevelName whitespace alignment issue #489
Comments
Thanks for reporting. I don't exactly remember what happened. @jsumners did you recall what happened on this one? |
#140 is the last time this issue was discussed to the best of my recollection. In short, we've had two attempts performed at introducing the requested alignment. It seems it is not an easy feature to implement. I would rather not keep churning on the issue, but whomever feels strongly about it is welcome to work on it. |
@JohnPolansky in pino-pretty v11.0.0 you now have access to the log level label and alignment in now possible. An example from my PR: {
customPrettifiers: {
level: (logLevel, key, log, { label, labelColorized }) => {
// pad to fix alignment
// assuming longest level is 5 characters long
// and may be colorized
const paddedLabel = label.padEnd(5)
if(labelColorized !== label) {
const padDiff = paddedLabel.length - label.length;
return labelColorized.padEnd(labelColorized.length + padDiff);
}
return paddedLabel;
}
},
} |
I'm using the following packages:
When I print out any messages using the
colorize()
option it appears that the message alignment is offAs you can see the INFO/WARN are throwing off messages which makes it a bit harder to read log messages. After searching various older posts I found a reference to this same issue back in 2021 that indicated this is an issue and it was fixed. Has something changed or am I missing a feature? #141
I also tried creating my own transport to
padEnd()
the log level, but this doesn't appear to work as belowHere is my full logger.js for review:
Thanks in advance for the help and the great tool.
The text was updated successfully, but these errors were encountered: