From 91e5956fb015c09effdbcbc24befb2888857a0ce Mon Sep 17 00:00:00 2001 From: sevketcaba Date: Wed, 1 Nov 2023 23:12:36 +0100 Subject: [PATCH] Added output parameter to log() method (#1) --- src/uglylogger/logger.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/uglylogger/logger.py b/src/uglylogger/logger.py index 4e384e2..fbe506b 100644 --- a/src/uglylogger/logger.py +++ b/src/uglylogger/logger.py @@ -408,6 +408,7 @@ def log( msg: typing.Any, color: LogColor | None = None, level: LogLevel = LogLevel.DEBUG, + output: LogOutput = LogOutput.ALL, ): """Logs both to the file and to the console @@ -416,9 +417,12 @@ def log( color (LogColor | None, optional): Color to overwrite, otherwise uses color by the LogLevel. Defaults to None. level (LogLevel, optional): Defaults to LogLevel.DEBUG. + output (LogOutput, optional): Defaults to LogOutput.ALL. """ - self.console(msg, color, level) - self.file(msg, level) + if LogOutput.CONSOLE in output: + self.console(msg, color, level) + if LogOutput.FILE in output: + self.file(msg, level) def debug( self,