Log interface

Basic logging setup.

rayvision_log.core.get_default_log_config()

Get the default logging configuration.

Returns:

The default logging configuration.

Return type:

dict

rayvision_log.core.init_logger(app_name, log_folder=None, log_name=None)

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.

Examples

>>> import logging
>>> from rayvision_log import init_logger
>>> app_name = "rayvision_api"
>>> init_logger(app_name)
>>> LOG = logging.getLogger(app_name)
Parameters:
  • app_name (str) – The application or package name for which to create a logger.

  • log_folder (str) – Custom log save location.

  • log_name (str) – Custom log file name.

rayvision_log.core.set_up_logger(app_name, log_config, use_orginal=False, log_folder=None, log_name=None)

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
                        }
                    }
                }
Parameters:
  • app_name (str) – Name of the application.

  • log_config (dict) – The configuration of the logger.

  • use_orginal (bool) – Whether to use the built-in log handler.

  • log_folder (str) – Custom log save location.

  • log_name (str) – Custom log file name.

References

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

Returns:

log path

rayvision_log.core.update_config(config)

Some python2 versions use native logging

Parameters:

config (dict) – logging config

Returns:

logging config.

Return type:

dict