Skip to content

particula.logger_setup

Attributes

NameDescription
configNo description.
current_dirNo description.
log_dirNo description.
loggerNo description.

Functions

NameDescription
setupSetup for logging in the particula package.

configattributemodule attribute#

config = {
  'version': 1,
  'disable_existing_loggers': False,
  'formatters': {
    'simple': {'format': '[%(levelname)s|%(module)s|L%(lineno)d]: %(message)s'},
    'detailed': {
      'format': '[%(levelname)s|%(module)s|L%(lineno)d] %(asctime)s: %(message)s',
      'datefmt': '%Y-%m-%dT%H:%M:%S%z'
    }
  },
  'handlers': {
    'stderr': {
      'class': 'logging.StreamHandler',
      'level': 'ERROR',
      'formatter': 'simple',
      'stream': 'ext://sys.stderr'
    },
    'file': {
      'class': 'logging.handlers.RotatingFileHandler',
      'level': 'DEBUG',
      'formatter': 'detailed',
      'filename': os.path.join(log_dir, 'particula.log'),
      'maxBytes': 25000000,
      'backupCount': 3
    }
  },
  'loggers': {
    'particula': {'level': 'DEBUG', 'handlers': ['file', 'stderr'], 'propagate': False},
    'root': {'level': 'ERROR', 'handlers': ['stderr', 'file']}
  }
}

current_dirattributemodule attribute#

current_dir = os.path.dirname(os.path.abspath(__file__))

log_dirattributemodule attribute#

log_dir = os.path.join(current_dir, 'logging')

loggerattributemodule attribute#

logger = logging.getLogger('particula')

setupfunction#

def setup()

Setup for logging in the particula package.