Skip to content

Logger level should not be set #336

@coezbek

Description

@coezbek

It is customary for Python packages to not set the log levels, but let library users decide which logging to enable.

At least NeMo-text-processing shouldn't override if users have disabled logging from NeMo.

So instead just setting the level to INFO:

logger = logging.getLogger("NeMo-text-processing")
c_handler = logging.StreamHandler()
logger.addHandler(c_handler)
logger.setLevel(logging.INFO)
logFormatter = logging.Formatter(fmt=' %(name)s :: %(levelname)-8s :: %(message)s')
c_handler.setFormatter(logFormatter)

At least it should be:

if logger.level == logging.NOTSET: 
    logger.setLevel(logging.INFO)

This would honor logging configuration set before the library is loaded to suppress logging output printed during initialization.

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