Skip to content

pyntc.log

Logging utilities for Pyntc.

pyntc.log.APP = 'pyntc' module-attribute

Application name, used as the logging root.

pyntc.log.DEBUG_FORMAT = '%(asctime)s [%(levelname)s] [%(module)s] [%(funcName)s] %(name)s: %(message)s' module-attribute

Logging format used when debug output is enabled.

pyntc.log.FORMAT = '%(asctime)s [%(levelname)s] %(name)s: %(message)s' module-attribute

Logging format to use.

pyntc.log.get_log(name=None)

Get log namespace and creates logger and rotating file handler.

A :class:RotatingFileHandler is attached if the PYNTC_LOG_FILE environment variable is set, in which case its value is used as the log file path.

Parameters:

Name Type Description Default
name str

Sublogger name. Defaults to None.

None

Returns:

Type Description
logger

Return a logger instance in the :data:APP namespace.

pyntc.log.init(**kwargs)

Initialize logging using sensible defaults.

If keyword arguments are passed to this function, they will be passed directly to the :func:logging.basicConfig call in turn.

Parameters:

Name Type Description Default
**kwargs dict

Arguments to pass for logging configuration

{}

pyntc.log.logger(level)

Wrap around logger methods.

Parameters:

Name Type Description Default
level str

defines the log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)

required

Returns:

Type Description
str

Returns logger. type of string.