abseil / abseil-py

Abseil Common Libraries (Python)
Apache License 2.0
2.28k stars 245 forks source link

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

Open skye opened 3 years ago

skye commented 3 years ago

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 commented 3 years ago

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

skye commented 3 years ago

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