cambrian.utils.logger ===================== .. py:module:: cambrian.utils.logger .. autoapi-nested-parse:: Provides a custom logger object. Should be used like the following: .. code-block:: python from cambrian.utils.logger import get_logger get_logger().fatal("Fatal") get_logger().error("Error") get_logger().warn("Warning") get_logger().info("Information") get_logger().debug("Debug") Classes ------- .. autoapisummary:: cambrian.utils.logger.MjCambrianFileHandler cambrian.utils.logger.MjCambrianTqdmStreamHandler cambrian.utils.logger.MjCambrianLoggerMaxLevelFilter cambrian.utils.logger.MjCambrianOnceFilter Module Contents --------------- .. py:class:: MjCambrianFileHandler(filename, *args, **kwargs) Bases: :py:obj:`logging.FileHandler` A file handler which creates the directory if it doesn't exist. .. py:class:: MjCambrianTqdmStreamHandler(stream=None) Bases: :py:obj:`logging.StreamHandler` A handler that uses tqdm.write to log messages. .. py:method:: emit(record) Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an 'encoding' attribute, it is used to determine how to do the output to the stream. .. py:class:: MjCambrianLoggerMaxLevelFilter(max_level) Bases: :py:obj:`logging.Filter` This filter sets a maximum level. .. py:method:: filter(record) Determine if the specified record is to be logged. Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place. .. py:class:: MjCambrianOnceFilter Bases: :py:obj:`logging.Filter` This filter allows a message to be logged only once. .. py:method:: filter(record) Determine if the specified record is to be logged. Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.