scm.reactmap.RMLogger

class scm.reactmap.RMLogger(print_level='error', log_level='info', write_log=False, log_name='RM_Log')

This is the logger class for reactmap. This class handles all output from other reactmap components. An instance of this class is available at the package level (as reactmap.logger) and is used throughout the solution process.

Table 5 Useful Output and Logging Options

Keyword

Options/Description

print_level

These options indicate the level of information to write to stdout.
  • ‘info’ - output every step of the solution process

  • ‘status’ (default) - output a summary of the solution process

  • ‘warning’ - only output warnings

  • ‘error’ - only output errors

  • ‘critical’ - only output critical errors

  • ‘none’ - do not write to stdout

log_level

These options indicate the level of information to write to the logfile. write_log must be True for these options to take effect.
  • ‘info’ - output every step of the solution process

  • ‘status’ (default) - output a summary of the solution process

  • ‘warning’ - only output warnings

  • ‘error’ - only output errors

  • ‘critical’ - only output critical errors

  • ‘none’ - do not write to log

write_log

  • True - Write a log file

  • False (default) - Do not write a log file

Attributes

write_log

True/False if a log file should be written (defaults to False)

Methods

add_to_log(message)

Adds a message to the log. This function also checks if the internal log string becomes to large, and will flush the log to disk.

Keyword Arguments

message (str) – The message to add to the log.

conclude_mapping(reaction)

When a mapping is finished. Write a small concluding message about the reaction results.

Keyword Arguments

reaction (reactmap.Reaction) – The reaction that will is about to be solved.

critical(message)

Create a message of level critical.

Keyword Arguments

message (str) – The message to be logged and/or printed.

error(message)

Create a message of level error.

Keyword Arguments

message (str) – The message to be logged and/or printed.

info(message)

Create a message of level info.

Keyword Arguments

message (str) – The message to be logged and/or printed.

new_reaction(reaction)

When starting to solve a new problem, this function will show some information about the problem, like the name of the reaction, the amount of atoms and number of bonds for both the reactant and product molecules.

Keyword Arguments

reaction (reactmap.Reaction) – The reaction that will is about to be solved.

open_new_log_file()

Open a log file named after the set log name.

print_message(message)

Prints a message to the command line.

Keyword Arguments

message (str) – The message to be printed.

set_log_level(output)
Set the log level that messages need to exceed in order to be saved to the log. The options are:
  • info : Show all messages. Also the least important messages as trying individual heuristics.

  • status : Show mayor points in the solving process, like trying heuristics or starting with solving the MILP model.

  • warning : Show warnings. For example when certain settings cannot be used and are thus turned off.

  • error : Show errors.

  • critical : Shows critical errors that force the solver to quit with this problem.

  • none : Show no messages.

set_print_level(output)
Set the print level that messages need to exceed in order to be printed in the command line. The options are:
  • info : Show all messages. Also the least important messages as trying individual heuristics.

  • status : Show mayor points in the solving process, like trying heuristics or starting with solving the MILP model.

  • warning : Show warnings. For example when certain settings cannot be used and are thus turned off.

  • error : Show errors.

  • critical : Shows critical errors that force the solver to quit with this problem.

  • none : Show no messages.

start_new_log_file(log_name='RM_Log')

Start a new log file. If a previous log is still open, it will be closed.

Keyword Arguments

log_name (str) – The name of the file. The default is ‘RM_Log’.

status(message)

Create a message of level status.

Keyword Arguments

message (str) – The message to be logged and/or printed.

warning(message)

Create a message of level warning.

Keyword Arguments

message (str) – The message to be logged and/or printed.

write_data()

Flushes the current log to disk.