abseil-py icon indicating copy to clipboard operation
abseil-py copied to clipboard

How to turn on vlog for a specific file?

Open skye opened this issue 4 years ago • 2 comments

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.)

skye avatar Oct 29 '20 20:10 skye

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: https://github.com/abseil/abseil-py/blob/ddbd7d46d01fa71b0584e948d68fcd1d47bea0c4/absl/logging/init.py#L312-L318

yilei avatar Oct 29 '20 21:10 yilei

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).

skye avatar Oct 29 '20 21:10 skye