cf.LOG_LEVEL¶

cf.LOG_LEVEL(*log_level)[source]

The minimal level of seriousness of log messages which are shown.

This can be adjusted to filter out potentially-useful log messages generated by cf at runtime, such that any messages marked as having a severity below the level set will not be reported.

For example, when set to 'WARNING' (or equivalently 1), all messages categorised as 'DEBUG' or 'INFO' will be supressed, and only warnings will emerge.

See https://ncas-cms.github.io/cf-python/tutorial.html#logging for a detailed breakdown on the levels and configuration possibilities.

The default level is 'WARNING' (1).

New in version 3.5.0.

Parameters
log_level: str or int, optional

The new value of the minimal log severity level. This can be specified either as a string equal (ignoring case) to the named set of log levels or identifier ‘DISABLE’, or an integer code corresponding to each of these, namely:

• 'DISABLE' (0);

• 'WARNING' (1);

• 'INFO' (2);

• 'DETAIL' (3);

• 'DEBUG' (-1).

Returns
str

The value prior to the change, or the current value if no new value was specified (or if one was specified but was not valid). Note the string name, rather than the equivalent integer, will always be returned.

Examples:

>>> LOG_LEVEL()  # get the current value
'WARNING'
>>> LOG_LEVEL('INFO')  # change the value to 'INFO'
'WARNING'
>>> LOG_LEVEL()
'INFO'
>>> LOG_LEVEL(0)  # set to 'DISABLE' via corresponding integer
'INFO'
>>> LOG_LEVEL()
'DISABLE'