jina.logging.logger module#

class jina.logging.logger.RichHandler(*args, **kwargs)[source]#

Bases: RichHandler

Override the original rich handler for more compact layout.

Initializes the instance - basically setting the formatter to None and the filter list to empty.

class jina.logging.logger.SysLogHandlerWrapper(address=('localhost', 514), facility=1, socktype=None)[source]#

Bases: SysLogHandler

Override the priority_map SysLogHandler.

Warning

This messages at DEBUG and INFO are therefore not stored by ASL, (ASL = Apple System Log) which in turn means they can’t be printed by syslog after the fact. You can confirm it via syslog or tail -f /var/log/system.log.

Initialize a handler.

If address is specified as a string, a UNIX socket is used. To log to a local syslogd, “SysLogHandler(address=”/dev/log”)” can be used. If facility is not specified, LOG_USER is used. If socktype is specified as socket.SOCK_DGRAM or socket.SOCK_STREAM, that specific socket type will be used. For Unix sockets, you can also specify a socktype of None, in which case socket.SOCK_DGRAM will be used, falling back to socket.SOCK_STREAM.

priority_map = {'CRITICAL': 'critical', 'DEBUG': 'debug', 'ERROR': 'error', 'INFO': 'info', 'WARNING': 'warning'}#
class jina.logging.logger.JinaLogger(context, name=None, log_config=None, quiet=False, **kwargs)[source]#

Bases: object

Build a logger for a context.

Parameters
  • context (str) – The context identifier of the class, module or method.

  • log_config (Optional[str]) – The configuration file for the logger.

configuration to group logs by deployment. :return:: an executor object.

supported = {'FileHandler', 'RichHandler', 'StreamHandler', 'SysLogHandler'}#
property handlers#

Get the handlers of the logger.

Return:

Handlers of logger.

close()[source]#

Close all the handlers.

add_handlers(config_path=None, **kwargs)[source]#

Add handlers from config file.

Parameters
  • config_path (Optional[str]) – Path of config file.

  • kwargs – Extra parameters.