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

Specify log file path as {module, function} #58

Open
albertored opened this issue Nov 18, 2018 · 0 comments
Open

Specify log file path as {module, function} #58

albertored opened this issue Nov 18, 2018 · 0 comments

Comments

@albertored
Copy link

Sometimes I need to log to different files based on some log metadata. Imagine for instance of having a variable number of entities handled by your application, it can be useful to log actions regarding each entity in a separate file.

This can already be done with metadata_filter if you know in advance which are the entities you manage. But, if entities can change at application runtime you can't.

My proposal is to allow specifying the path of the log file as a {module, function} tuple, the function will be called giving log metadata as argument (maybe also log_level?) and it should return the log file path where the log entry should be written.

What do you think about? I can submit a PR if you think is worth.

PS: this is somehow related to the first part of #18 but it allows a more fine customization of the path. I'm perfectly ok also with the solution proposed in #18 if you think is safer.

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

1 participant