omnetpypy.sim_log

This module implements a specific logging API for simulations.

omnetpypy.sim_log.critical(message, module_id=None, time=None)[source]

Log a message with level CRITICAL on the logger.

Parameters:
messagestr

The message to be logged. It should not contain the current simulation time because it is already present in the log format.

module_idint or str or None optional

If not None, an additional string is added to the log entry, containing the module identifier (or its name).

timeint or float or None, optional

If not None, an additional string is added to the log entry, containing the current simulation time.

omnetpypy.sim_log.debug(message, module_id=None, time=None)[source]

Log a message with level DEBUG on the logger.

Parameters:
messagestr

The message to be logged. It should not contain the current simulation time because it is already present in the log format.

module_idint or str or None optional

If not None, an additional string is added to the log entry, containing the module identifier (or its name).

timeint or float or None, optional

If not None, an additional string is added to the log entry, containing the current simulation time.

omnetpypy.sim_log.error(message, module_id=None, time=None)[source]

Log a message with level ERROR on the logger.

Parameters:
messagestr

The message to be logged. It should not contain the current simulation time because it is already present in the log format.

module_idint or str or None optional

If not None, an additional string is added to the log entry, containing the module identifier (or its name).

timeint or float or None, optional

If not None, an additional string is added to the log entry, containing the current simulation time.

omnetpypy.sim_log.info(message, module_id=None, time=None)[source]

Log a message with level INFO on the logger.

Parameters:
messagestr

The message to be logged. It should not contain the current simulation time because it is already present in the log format.

module_idint or str or None optional

If not None, an additional string is added to the log entry, containing the module identifier (or its name).

timeint or float or None, optional

If not None, an additional string is added to the log entry, containing the current simulation time.

omnetpypy.sim_log.log_to_console(level=10)[source]

Activate log output to the stdout console.

Parameters:
levelint, optional

The logging level for the console. Defaults to logging.DEBUG

Returns:
logging.StreamHandler

The handler of the log output.

omnetpypy.sim_log.log_to_file(filename, level=10)[source]

Activate log output to the specified file.

Parameters:
filenamestr

The name of the output log file. If not present it is created. It is opened in append mode.

levelint, optional

The logging level on the file. Defaults to logging.DEBUG

Returns:
logging.FileHandler

The handler of the log output.

omnetpypy.sim_log.remove_console_log()[source]

Remove the console log handler.

omnetpypy.sim_log.set_log_level(level)[source]

Set the log level on all outputs.

Parameters:
levelint

The new log level. Can be one of the following: - logging.DEBUG === “DEBUG” === 0 - logging.INFO === “INFO” === 1 - logging.WARNING === “WARNING” === 2 - logging.ERROR === “ERROR” === 3 - logging.CRITICAL === “CRITICAL” === 4

omnetpypy.sim_log.warning(message, module_id=None, time=None)[source]

Log a message with level WARNING on the logger.

Parameters:
messagestr

The message to be logged. It should not contain the current simulation time because it is already present in the log format.

module_idint or str or None optional

If not None, an additional string is added to the log entry, containing the module identifier (or its name).

timeint or float or None, optional

If not None, an additional string is added to the log entry, containing the current simulation time.