IPython Documentation

Table Of Contents

Previous topic

core.ipapi

Next topic

core.macro

This Page

core.logger

Module: core.logger

Inheritance diagram for IPython.core.logger:

Logger class for IPython’s logging facilities.

Logger

class IPython.core.logger.Logger(home_dir, logfname='Logger.log', loghead='', logmode='over')

Bases: object

A Logfile class with different policies for file creation

__init__(home_dir, logfname='Logger.log', loghead='', logmode='over')
close_log()

Fully stop logging and close log file.

In order to start logging again, a new logstart() call needs to be made, possibly (though not necessarily) with a new filename, mode and other options.

log(line_mod, line_ori)

Write the sources to a log.

Inputs:

  • line_mod: possibly modified input, such as the transformations made

by input prefilters or input handlers of various kinds. This should always be valid Python.

  • line_ori: unmodified input line from the user. This is not

necessarily valid Python.

log_write(data, kind='input')

Write data to the log file, if active

logmode
logstart(logfname=None, loghead=None, logmode=None, log_output=False, timestamp=False, log_raw_input=False)

Generate a new log-file with a default header.

Raises RuntimeError if the log has already been started

logstate()

Print a status message about the logger.

logstop()

Fully stop logging and close log file.

In order to start logging again, a new logstart() call needs to be made, possibly (though not necessarily) with a new filename, mode and other options.

switch_log(val)

Switch logging on/off. val should be ONLY a boolean.