log_to_file#

Logger.log_to_file(filename='pymechanical.log', level=10)#

Add a file handler to the logger.

Parameters:
filenamestr, optional

Name of the file to write log messages to. The default is 'pymechanical.log'.

levelstr, optional

Level of logging. The default is 10, in which case the "DEBUG" level is used. Options are "DEBUG", "INFO", "WARNING" and "ERROR".

Examples

Write to the pymechanical.log file in the current working directory.

>>> from ansys.mechanical.core import LOG
>>> import os
>>> file_path = os.path.join(os.getcwd(), 'pymechanical.log')
>>> LOG.log_to_file(file_path)