diff options
| author | tassaron | 2026-01-14 21:56:50 -0500 |
|---|---|---|
| committer | tassaron | 2026-01-14 21:56:50 -0500 |
| commit | a2c11b6ca727ece4f2f0bd09c6cdaf8705bde9cd (patch) | |
| tree | ccb89287302cc9cff3dc56a3bad01964d09f8be5 /src | |
| parent | 290dcc48a14833f43f5d2d298035df8bd94f3588 (diff) | |
fix file logging for main program log
Diffstat (limited to 'src')
| -rw-r--r-- | src/avp/command.py | 3 | ||||
| -rw-r--r-- | src/avp/core.py | 10 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/avp/command.py b/src/avp/command.py index 7f6f2d1..61612ef 100644 --- a/src/avp/command.py +++ b/src/avp/command.py @@ -101,9 +101,8 @@ class Command(QtCore.QObject): args = parser.parse_args() if args.verbose: - core.FILE_LOGLVL = logging.DEBUG core.STDOUT_LOGLVL = logging.DEBUG - core.Core.makeLogger() + core.Core.makeLogger(deleteOldLogs=False, fileLogLvl=logging.DEBUG) if args.log: self.createLogFile() diff --git a/src/avp/core.py b/src/avp/core.py index df6ff63..402b532 100644 --- a/src/avp/core.py +++ b/src/avp/core.py @@ -15,8 +15,6 @@ from . import toolkit log = logging.getLogger("AVP.Core") STDOUT_LOGLVL = logging.WARNING -FILE_LIBLOGLVL = logging.WARNING -FILE_LOGLVL = logging.INFO class Core: @@ -555,7 +553,7 @@ class Core: cls.settings.setValue(key, val) @staticmethod - def makeLogger(deleteOldLogs=False): + def makeLogger(deleteOldLogs=False, fileLogLvl=None): # send critical log messages to stdout logStream = logging.StreamHandler() logStream.setLevel(STDOUT_LOGLVL) @@ -564,7 +562,7 @@ class Core: log = logging.getLogger("AVP") log.addHandler(logStream) - if FILE_LOGLVL is not None: + if fileLogLvl is not None: # write log files as well! Core.logEnabled = True logFilename = os.path.join(Core.logDir, "avp_debug.log") @@ -576,9 +574,9 @@ class Core: os.remove(log_) logFile = logging.FileHandler(logFilename, delay=True) - logFile.setLevel(FILE_LOGLVL) + logFile.setLevel(fileLogLvl) libLogFile = logging.FileHandler(libLogFilename, delay=True) - libLogFile.setLevel(FILE_LIBLOGLVL) + libLogFile.setLevel(fileLogLvl) fileFormatter = logging.Formatter( "[%(asctime)s] %(threadName)-10.10s %(name)-23.23s %(levelname)s: " "%(message)s" |
