backend.globaleaks.utils.log

Module Contents

Classes

LogObserver Tracks and logs exceptions generated within the application
Logger Customized LogPublisher

Functions

timedelta_to_milliseconds(t) Convert a timedelta to millisecond
log_remove_escapes(s) This function removes escape sequence from log strings
openLogFile(logfile, max_file_size, rotated_log_files) Open a log file
logFormatter(timestamp, request) Log the request adding timestamp
backend.globaleaks.utils.log.timedelta_to_milliseconds(t)[source]

Convert a timedelta to millisecond

Parameters:t – the time delta object to be converted
Returns:the timedelta representation in milliseconds
backend.globaleaks.utils.log.log_remove_escapes(s)[source]

This function removes escape sequence from log strings

Parameters:s – A string to be escaped
Returns:The escaped string
backend.globaleaks.utils.log.openLogFile(logfile, max_file_size, rotated_log_files)[source]

Open a log file

Parameters:
  • logfile – A log file path
  • max_file_size – A maximum size accepted before rotation
  • rotated_log_files – A number of rotated log files
Returns:

A file descriptor

backend.globaleaks.utils.log.logFormatter(timestamp, request)[source]

Log the request adding timestamp

Parameters:
  • timestamp – A timestamp of the log entry
  • request – A request to be logged
Returns:

A formatted log entry

class backend.globaleaks.utils.log.LogObserver[source]

Bases: twisted.python.log.FileLogObserver

Tracks and logs exceptions generated within the application

emit(self, eventDict)[source]

Handles formatting system log messages along with incrementing the objs error counters. The eventDict is generated by the arguments passed to each log level call. See the unittests for an example.

class backend.globaleaks.utils.log.Logger[source]

Bases: object

Customized LogPublisher

loglevel[source]
_verbosity_dict[source]
setloglevel(self, loglevel)[source]
_print_logline(self, prefix, msg, *args, **kwargs)[source]
debug(self, msg, *args, **kwargs)[source]
info(self, msg, *args, **kwargs)[source]
err(self, msg, *args, **kwargs)[source]
exception(self, error)[source]

Formats exceptions for output to logs and/or stdout

Parameters:error (Exception or twisted.python.failure.Failure) –
backend.globaleaks.utils.log.log[source]