Log

class Log(*args, **kwargs)

Logging utilities.

No constructor, only static methods are available.

Methods

Debug(msg)

Log debug message.

Error(msg)

Log error message.

Flags()

Accessor to the log flags.

Flush()

Flush pending messages.

GetColor(severity)

Color accessor.

HasDebug()

Test whether debug level is enabled.

HasError()

Test whether error level is enabled.

HasInfo()

Test whether information level is enabled.

HasTrace()

Test whether execution trace level is enabled.

HasUser()

Test whether user level is enabled.

HasWarn()

Test whether warning level is enabled.

Info(msg)

Log information message.

Repeat(repeat)

Whether to report repeated messages.

SetColor(*args)

Color accessor.

SetFile(file)

Redirect logs to a file.

Show(flags)

Accessor to the log flags.

Trace(msg)

Log execution trace message.

User(msg)

Log user message.

Warn(msg)

Log warning message.

__init__(*args, **kwargs)
static Debug(msg)

Log debug message.

Parameters
messagestr

The message to log

static Error(msg)

Log error message.

Parameters
messagestr

The message to log

static Flags()

Accessor to the log flags.

Returns
flagsint

The enabled log flags.

static Flush()

Flush pending messages.

static GetColor(severity)

Color accessor.

Parameters
severityint

Log level

Returns
colorstr

Log color

static HasDebug()

Test whether debug level is enabled.

Returns
has_logbool

Whether the level is enabled

static HasError()

Test whether error level is enabled.

Returns
has_logbool

Whether the level is enabled

static HasInfo()

Test whether information level is enabled.

Returns
has_logbool

Whether the level is enabled

static HasTrace()

Test whether execution trace level is enabled.

Returns
has_logbool

Whether the level is enabled

static HasUser()

Test whether user level is enabled.

Returns
has_logbool

Whether the level is enabled

static HasWarn()

Test whether warning level is enabled.

Returns
has_logbool

Whether the level is enabled

static Info(msg)

Log information message.

Parameters
messagestr

The message to log

static Repeat(repeat)

Whether to report repeated messages.

Parameters
repeatbool

Whether to report repeated messages

static SetColor(*args)

Color accessor.

Parameters
severityint

Log level

colorstr or int

Log color

static SetFile(file)

Redirect logs to a file.

Parameters
file_namestr

Log file name

Examples

Write warnings in a file:

>>> import openturns as ot
>>> ot.Log.SetFile('Warnings.log')
static Show(flags)

Accessor to the log flags.

Parameters
flagsint

Log flags to enable.

Available values to be ORed:

  • DBG

  • INFO

  • USER

  • WARN

  • ERROR

  • TRACE

  • DEFAULT

  • NONE

  • ALL

Examples

Turn warnings off:

>>> import openturns as ot
>>> ot.Log.Show(ot.Log.NONE)
static Trace(msg)

Log execution trace message.

Parameters
messagestr

The message to log.

static User(msg)

Log user message.

Parameters
messagestr

The message to log

static Warn(msg)

Log warning message.

Parameters
messagestr

The message to log