EnvironBackend#

class ansys.mechanical.core.embedding.logger.environ.EnvironBackend#

Provides the environment variable backend for Mechanical logging.

Overview#

flush

Flush the log.

enable

Enable the given sink.

disable

Disable the log level for this sink.

set_log_level

Set the log level for this sink based on the Python log level.

set_auto_flush

Set whether to auto flush to the standard log file.

set_directory

Set the location to write the log file to.

set_base_directory

Set the base location to write the log file to.

can_log_message

Return whether a message with the given severity is outputted to the log.

log_message

Log the message to the configured logging mechanism.

Import detail#

from ansys.mechanical.core.embedding.logger.environ import EnvironBackend

Method detail#

EnvironBackend.flush()#

Flush the log.

EnvironBackend.enable(sink: int = sinks.StandardSinks.CONSOLE)#

Enable the given sink.

EnvironBackend.disable(sink: int = sinks.StandardSinks.CONSOLE)#

Disable the log level for this sink.

EnvironBackend.set_log_level(level: int, sink: int = sinks.StandardSinks.CONSOLE)#

Set the log level for this sink based on the Python log level.

EnvironBackend.set_auto_flush(flush: bool) None#

Set whether to auto flush to the standard log file.

EnvironBackend.set_directory(directory: str) None#

Set the location to write the log file to.

EnvironBackend.set_base_directory(base_directory: str) None#

Set the base location to write the log file to.

The base directory contains time-stamped subfolders where the log file is actually written to. If a base directory is set, it takes precedence over the set_directory location.

EnvironBackend.can_log_message(level: int) bool#

Return whether a message with the given severity is outputted to the log.

EnvironBackend.log_message(level: int, context: str, message: str) None#

Log the message to the configured logging mechanism.