Skip to content

Use non-root python logger #194

@araistrick

Description

@araistrick

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:

logging.error('Path not found: %s', config_path)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions