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

How to turn on vlog for a specific file? #156

Open
skye opened this issue Oct 29, 2020 · 2 comments
Open

How to turn on vlog for a specific file? #156

skye opened this issue Oct 29, 2020 · 2 comments

Comments

@skye
Copy link

skye commented Oct 29, 2020

The -v flag can be used to enable vlog messages across all files, but is it possible to enable only for a specific file(s)? I think the C++ logging library uses --vmodule but there's no such flag for Python, even though a comment in the code says it should be possible: https://github.com/abseil/abseil-py/blob/master/absl/logging/__init__.py#L53

(BTW it'd be great to document the -v flag somewhere, it took me a while to figure that one out.)

@yilei
Copy link
Contributor

yilei commented Oct 29, 2020

We don't have Abseil C++ logging integration (yet) so there is no --vmodule with absl.logging and you can't control per file.

We do have a separate per-logger control (instead of per-file) of levels, so if you use different loggers you can control with the --logger_levels flag:

flags.DEFINE_flag(
_LoggerLevelsFlag(
'logger_levels', {},
'Specify log level of loggers. The format is a CSV list of '
'`name:level`. Where `name` is the logger name used with '
'`logging.getLogger()`, and `level` is a level name (INFO, DEBUG, '
'etc). e.g. `myapp.foo:INFO,other.logger:DEBUG`'))

@skye
Copy link
Author

skye commented Oct 29, 2020

Thanks for the fast reply! I guess consider this a feature request for something akin to --vmodule then :) Using -v for now works well enough (which is realistically what I'll do instead instead of creating per-module loggers, although that would be the more "proper" thing to do).

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