picometer.logging ================= .. py:module:: picometer.logging Attributes ---------- .. autoapisummary:: picometer.logging.formatter picometer.logging.logger Classes ------- .. autoapisummary:: picometer.logging.LogEventHandler Functions --------- .. autoapisummary:: picometer.logging._get_logger picometer.logging.add_file_handler picometer.logging.register_log_listener Module Contents --------------- .. py:data:: formatter .. py:function:: _get_logger() -> logging.Logger Set up logging, but don't log yet in case picometer is used as package .. py:data:: logger .. py:function:: add_file_handler(path: Union[str, pathlib.Path]) -> logging.FileHandler If used as program, allow logging directly to a file using `FileHandler` .. py:class:: LogEventHandler(log_callback) Bases: :py:obj:`logging.Handler` Custom handler for external log processing, see `register_log_listener` .. py:attribute:: log_callback .. py:method:: emit(record) -> None Do whatever it takes to actually log the specified logging record. This version is intended to be implemented by subclasses and so raises a NotImplementedError. .. py:function:: register_log_listener(log_callback: Callable[[str], Any]) -> LogEventHandler A simple implementation, register function to call it for each log entry