A Python package providing a global logger with automatic configuration loading.
pip install globalogfrom globalog import LOG
# The logger will automatically load configuration from the nearest config file
LOG.info("This is an info message")
LOG.debug("This is a debug message")
# You can also explicitly initialize with a specific config file
LOG.init(config_file="path/to/config.json")The package looks for configuration files in the following order:
logging_config.jsonin the current directorylogging_config.yamlin the current directory- Default configuration if no config file is found
Example configuration file (logging_config.json):
{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"standard": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "standard",
"stream": "ext://sys.stdout"
}
},
"loggers": {
"": {
"handlers": ["console"],
"level": "INFO",
"propagate": true
}
}
}