日志接口

Basic logging setup.

rayvision_log.core.get_default_log_config()

Get the default logging configuration.

返回:The default logging configuration.
返回类型:dict
rayvision_log.core.init_logger(app_name)

Initialize logging with our default configuration.

An easier interface for artists to use to create loggers in their packages and applications. Any application that uses this will use the default logging configuration.

实际案例

>>> import logging
>>> from rayvision_log import init_logger
>>> app_name = "rayvision_api"
>>> init_logger(app_name)
>>> LOG = logging.getLogger(app_name)
参数:app_name (str) -- The application or package name for which to create a logger.
rayvision_log.core.set_up_logger(app_name, log_config, use_orginal=False)

Set up loggers based on given name and configuration.

Example

>>> app_name = "rayvision_api"
>>> log_config = {
                    formatters: {
                        file: {
                            format: '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
                        }
                    },
                    handlers: {
                        file: {
                            class: concurrent_log_handler.ConcurrentRotatingFileHandler
                        }
                    }
                }
参数:
  • app_name (str) -- Name of the application.
  • log_config (dict) -- The configuration of the logger.

References

https://pypi.org/project/ConcurrentLogHandler/

rayvision_log.core.update_config(config)

Some python2 versions use native logging

参数:config (dict) -- logging config
返回:logging config.
返回类型:dict