Skip to content
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

Padding module name #79

Closed
tekjar opened this issue Sep 11, 2021 · 5 comments
Closed

Padding module name #79

tekjar opened this issue Sep 11, 2021 · 5 comments

Comments

@tekjar
Copy link
Contributor

tekjar commented Sep 11, 2021

Is it possible to pad module names? Alignment is kinda screwed up (because of different module names) when I log different modules

image

Sometimes I also don't need full module path. Just module name would be sufficient. Is it possible to customize this?

@Drakulix
Copy link
Owner

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.

@tekjar
Copy link
Contributor Author

tekjar commented Sep 13, 2021

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

@Drakulix
Copy link
Owner

Drakulix commented Sep 13, 2021

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.

@tekjar
Copy link
Contributor Author

tekjar commented Oct 31, 2021

Hi @Drakulix . Created a PR for this

@Drakulix
Copy link
Owner

Feel free to re-open if anyone wants to extend this, but #85 added basic padding. Thanks @tekjar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants