APIBackend#

class ansys.mechanical.core.embedding.logger.windows_api.APIBackend#

Provides API backend for Mechanical logging system.

Overview#

flush

Flush the log manually.

enable

Enable logging.

disable

Disable logging.

set_log_level

Set the log level for Mechanical 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.windows_api import APIBackend

Method detail#

APIBackend.flush() None#

Flush the log manually.

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

Enable logging.

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

Disable logging.

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

Set the log level for Mechanical based on the Python log level.

APIBackend.set_auto_flush(flush: bool) None#

Set whether to auto flush to the standard log file.

APIBackend.set_directory(directory: str) None#

Set the location to write the log file to.

APIBackend.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.

This does not have an API to set at runtime.

APIBackend.can_log_message(level: int) bool#

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

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

Log the message to the configured logging mechanism.