Skip to content

Make a standardized Logger object and config #28

@phicks22

Description

@phicks22

The logger is in every class in the same way. These are four lines in each class __init__ function that could be a single line standardized across all classes that use the logger.

if logger is None:
  logger = setup_logger(__name__, level=loglevel, log_dir=logdir, console=console)
self.logger = logger
self.verbose = verbose

Additionally, writing entries in this logger requires a verbosity check inside the class for each chunk of logging entries. This makes the code ugly. It would be great if the verbosity checks are handled within a custom logging class.

Instead of:

if some_check:
  if verbose:
    logger.info("message")
  some_function()

Just have:

if some_check:
  logger.info("message")
  some_function()

Where the verbosity check would occur in the logger class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions