Exscript.logger module

Logging to memory.

class Exscript.logger.FileLogger(logdir, mode=u'a', delete=False, clearmem=True)[source]

Bases: Exscript.logger.Logger

A Logger that stores logs into files.

__init__(logdir, mode=u'a', delete=False, clearmem=True)[source]

The logdir argument specifies the location where the logs are stored. The mode specifies whether to append the existing logs (if any). If delete is True, the logs are deleted after they are completed, unless they have an error in them. If clearmem is True, the logger does not store a reference to the log in it. If you want to use the functions from Exscript.util.report with the logger, clearmem must be False.

add_log(job_id, name, attempt)[source]
log_aborted(job_id, exc_info)[source]
log_succeeded(job_id)[source]
class Exscript.logger.Log(name)[source]

Bases: future.types.newobject.newobject

__init__(name)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

aborted(exc_info)[source]

Called by a logger to log an exception.

get_error(include_tb=True)[source]
get_name()[source]
has_ended()[source]
has_error()[source]
started()[source]

Called by a logger to inform us that logging may now begin.

succeeded()[source]

Called by a logger to inform us that logging is complete.

write(*data)[source]
class Exscript.logger.Logfile(name, filename, mode=u'a', delete=False)[source]

Bases: Exscript.logger.Log

This class logs to two files: The raw log, and sometimes a separate log containing the error message with a traceback.

__init__(name, filename, mode=u'a', delete=False)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

aborted(exc_info)[source]
started()[source]
succeeded()[source]
write(*data)[source]
class Exscript.logger.Logger[source]

Bases: future.types.newobject.newobject

A QueueListener that implements logging for the queue. Logs are kept in memory, and not written to the disk.

__init__()[source]

Creates a new logger instance. Use the Exscript.util.log.log_to decorator to send messages to the logger.

add_log(job_id, name, attempt)[source]
get_aborted_actions()[source]

Returns the number of jobs that were aborted.

get_aborted_logs()[source]
get_logs()[source]
get_succeeded_actions()[source]

Returns the number of jobs that were completed successfully.

get_succeeded_logs()[source]
log(job_id, message)[source]
log_aborted(job_id, exc_info)[source]
log_succeeded(job_id)[source]
class Exscript.logger.LoggerProxy(parent, logger_id)[source]

Bases: future.types.newobject.newobject

An object that has a 1:1 relation to a Logger object in another process.

__init__(parent, logger_id)[source]

Constructor.

Parameters:parent (multiprocessing.Connection) – A pipe to the associated pipe handler.
add_log(job_id, name, attempt)[source]
log(job_id, message)[source]
log_aborted(job_id, exc_info)[source]
log_succeeded(job_id)[source]