PyAnsysHeartCustomAdapter#

class ansys.health.heart.logger.PyAnsysHeartCustomAdapter(logger: logging.Logger)#

Bases: logging.LoggerAdapter

Keeps the reference to the PyAnsys Heart service instance dynamic.

If you use the standard approach, which is supplying extra input to the logger, you must input PyAnsys Heart service instances each time that you log a message.

Using adapters, you only need to specify the PyAnsys Heart service instance that you are referring to once.

Overview#

process

Process extra arguments.

log_to_file

Add a file handler to the logger.

log_to_stdout

Add a stdout handler to the logger.

setLevel

Change the log level of the object and the attached handlers.

Import detail#

from ansys.health.heart.logger import PyAnsysHeartCustomAdapter

Attribute detail#

PyAnsysHeartCustomAdapter.level = None#
PyAnsysHeartCustomAdapter.file_handler: logging.FileHandler | None = None#
PyAnsysHeartCustomAdapter.std_out_handler: logging.StreamHandler | None = None#
PyAnsysHeartCustomAdapter.logger#

Method detail#

PyAnsysHeartCustomAdapter.process(msg: str, kwargs: MutableMapping[str, Dict[str, str]])#

Process extra arguments.

PyAnsysHeartCustomAdapter.log_to_file(filename: str = FILE_NAME, level: LOG_LEVEL_TYPE = LOG_LEVEL_FILE) None#

Add a file handler to the logger.

Parameters:
filenamestr, default: FILE_NAME

Name of the file to record logs to.

levelstr or int, default: LOG_LEVEL

Level of logging, such as DEBUG.

PyAnsysHeartCustomAdapter.log_to_stdout(level: LOG_LEVEL_TYPE = LOG_LEVEL_STDOUT) None#

Add a stdout handler to the logger.

Parameters:
levelstr or int, default: LOG_LEVEL

Level of the logging record.

PyAnsysHeartCustomAdapter.setLevel(level: int | str = 'DEBUG')#

Change the log level of the object and the attached handlers.