google / google/gin-config

Use non-root python logger

Open
#194 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.2k
Forks
122
Avg merge
5d 10h
Merged PRs (30d)
2

Description

My code does something akin to the following.

```
gin.add_config_file_search_path(folder1)
gin.add_config_file_search_path(folder2)
gin.parse_config_files_and_bindings(...)
```

I am now using `gin` from within code which is itself now packages as a pip-installable python package. Ever since executing this change, I now see logging output like the following:

```
INFO:root:system_path_file_exists:base_surface_registry.gin
ERROR:root:Path not found: base_surface_registry.gin
INFO:root:system_path_file_exists:natural.gin
ERROR:root:Path not found: natural.gin
INFO:root:system_path_file_exists:performance/dev.gin
ERROR:root:Path not found: performance/dev.gin
INFO:root:system_path_file_exists:disable_assets/no_creatures.gin
ERROR:root:Path not found: disable_assets/no_creatures.gin
INFO:root:system_path_file_exists:performance/fast_terrain_assets.gin
ERROR:root:Path not found: performance/fast_terrain_assets.gin
```
I would like to mute all gin-related logging, but it appears gin is using the root logging.info() rather than `logger = logging.getLogger(__name__); logging.info(...)` as is recommended.

Example: https://github.com/google/gin-config/blob/ddd964cebaeaadcb9d1a9b01eaabdfd11dbe03d9/gin/resource_reader.py#L55

Switching to the recommended getLogger(__name__) would allow me to `logging.getLogger("gin").setLevel(logging.CRITICAL)` to ignore these messages.

I could likely PR this if theres any chance of it being accepted.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.