diff --git a/example/logger/logger.py b/example/logger/logger.py index e45136f..23cbed4 100644 --- a/example/logger/logger.py +++ b/example/logger/logger.py @@ -8,7 +8,7 @@ from lib_not_dr.logger.logger import Logger if __name__ == '__main__': logger = Logger.get_logger_by_name('test') - logger.level = 0 + logger.global_level = 0 logger.info('Hello World!') diff --git a/lib_not_dr/logger/logger.py b/lib_not_dr/logger/logger.py index 7bfad16..020edbc 100644 --- a/lib_not_dr/logger/logger.py +++ b/lib_not_dr/logger/logger.py @@ -63,6 +63,31 @@ class Logger(Options): self.outputs.remove(output) self.level = max(self.level, *[output.level for output in self.outputs]) + @property + def global_level(self) -> int: + """ + Get the global logging level. + + Returns: + int: The global logging level. + """ + return self.level + + @global_level.setter + def global_level(self, level: int) -> None: + """ + Set the global logging level. + + Args: + level (int): The global logging level. + + Returns: + None + """ + self.level = level + for output in self.outputs: + output.level = level + def make_log(self, messages: List[str], tag: Optional[str] = None,