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

implements format_file_location #232

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

imlazyeye
Copy link

Implements a new option to the format builder to make the header on logs display the file and line number a log originated from.

I work on a project (a binary) that uses this library and we often have trouble identifying where scattered warnings / debug messages are actually being fired from. The specificity of files + line numbers is more helpful for us, who will never have these logs displayed to an end-user.

I tried to implement this with as small of a footprint as possible, but that does lead to a bit of weirdness with the relationship between the new format_file_location and format_module_path, since they both want control over the header. I have just made it so that attempting to enable both will print out a warning that you can't and then rejects the second request. A more elegant way of handling this may be creating a type that can contain both behaviors (leading to something like format_header_style(HeaderStyle::ModulePath), but I don't love the idea of users having to import a new type.

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

Successfully merging this pull request may close these issues.

1 participant