Closed tekjar closed 2 years ago
Padding the module name would require to know all possible module names in advance to compute the maximum length of the module string. This is currently not something log (and therefor simplelog) supports.
But parsing the module path and just logging the module name could be done. I would accept pull requests adding this feature.
Isn't passing padding as user input and overflowing if a module name doesn't fit not an option? User will know what's the maximum module length and set padding accordingly
Isn't passing padding as user input and overflowing if a module name doesn't fit not an option? User will know what's the maximum module length and set padding accordingly
That could also work, I guess, and would be conceptually very similar to the existing thread padding:
But a ModulePadding
type would use the provided usize
as an upper bound rather than an amount of spaces.
I would accept a PR for that proposal (or better in addition to shortening the module path) as well.
Feel free to re-open if anyone wants to extend this, but #85 added basic padding. Thanks @tekjar
Is it possible to pad module names? Alignment is kinda screwed up (because of different module names) when I log different modules
Sometimes I also don't need full module path. Just module name would be sufficient. Is it possible to customize this?