Configuration#

class ansys.mechanical.core.embedding.logger.Configuration#

Configures logger for Mechanical embedding.

Overview#

configure

Configure the logger for PyMechanical embedding.

set_log_to_stdout

Configure logging to write to the standard output.

set_log_to_file

Configure logging to write to a file.

set_log_level

Set the log level for all configured sinks.

set_log_directory

Configure logging to write to a directory.

set_log_base_directory

Configure logging to write in a time-stamped subfolder in this directory.

set_wbtracing

Enable or disable WBTRACING for COM-level diagnostic output.

Import detail#

from ansys.mechanical.core.embedding.logger import Configuration

Method detail#

classmethod Configuration.configure(level=logging.WARNING, directory=None, base_directory=None, to_stdout=True, wbtracing=None)#

Configure the logger for PyMechanical embedding.

Parameters:
levelint, optional

Level of logging that is defined in the logging package. The default is ‘WARNING’. Options are "DEBUG", "INFO", "WARNING", and "ERROR".

directorystr, optional

Directory to write log file to. The default is None, but by default the log will appear somewhere in the system temp folder.

base_directory: str, optional

Base directory to write log files to. Each instance of Mechanical will write its log to a time-stamped subfolder within this directory. This is only possible to set before Mechanical is initialized.

to_stdoutbool, optional

Whether to write log messages to the standard output, which is the command line. The default is True.

wbtracingbool, optional

Whether to enable WBTRACING for COM-level diagnostic output. The default is None, which preserves the current setting. When enabled, trace messages from Mechanical’s internal COM implementation are written to stdout. Setting this after Mechanical is initialized will have no effect on the running instance but will persist in the environment.

classmethod Configuration.set_log_to_stdout(value: bool) None#

Configure logging to write to the standard output.

classmethod Configuration.set_log_to_file(value: bool) None#

Configure logging to write to a file.

classmethod Configuration.set_log_level(level: int) None#

Set the log level for all configured sinks.

classmethod Configuration.set_log_directory(value: str) None#

Configure logging to write to a directory.

classmethod Configuration.set_log_base_directory(directory: str) None#

Configure logging to write in a time-stamped subfolder in this directory.

classmethod Configuration.set_wbtracing(enabled: bool) None#

Enable or disable WBTRACING for COM-level diagnostic output.

WBTRACING enables trace-level diagnostic output from Mechanical’s internal COM implementation. When enabled, trace messages are written to stdout.

Note

Setting this after Mechanical has been initialized will have no effect on the running instance. The env var is set for completeness (e.g. for a future instance in the same process), but a warning is issued.

Parameters:
enabledbool

Whether to enable WBTRACING.