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 | |
| parent | 290dcc48a14833f43f5d2d298035df8bd94f3588 (diff) | |
fix file logging for main program log
| -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): | |||
| 101 | args = parser.parse_args() | 101 | args = parser.parse_args() |
| 102 | 102 | ||
| 103 | if args.verbose: | 103 | if args.verbose: |
| 104 | core.FILE_LOGLVL = logging.DEBUG | ||
| 105 | core.STDOUT_LOGLVL = logging.DEBUG | 104 | core.STDOUT_LOGLVL = logging.DEBUG |
| 106 | core.Core.makeLogger() | 105 | core.Core.makeLogger(deleteOldLogs=False, fileLogLvl=logging.DEBUG) |
| 107 | 106 | ||
| 108 | if args.log: | 107 | if args.log: |
| 109 | self.createLogFile() | 108 | 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 | |||
| 15 | 15 | ||
| 16 | log = logging.getLogger("AVP.Core") | 16 | log = logging.getLogger("AVP.Core") |
| 17 | STDOUT_LOGLVL = logging.WARNING | 17 | STDOUT_LOGLVL = logging.WARNING |
| 18 | FILE_LIBLOGLVL = logging.WARNING | ||
| 19 | FILE_LOGLVL = logging.INFO | ||
| 20 | 18 | ||
| 21 | 19 | ||
| 22 | class Core: | 20 | class Core: |
| @@ -555,7 +553,7 @@ class Core: | |||
| 555 | cls.settings.setValue(key, val) | 553 | cls.settings.setValue(key, val) |
| 556 | 554 | ||
| 557 | @staticmethod | 555 | @staticmethod |
| 558 | def makeLogger(deleteOldLogs=False): | 556 | def makeLogger(deleteOldLogs=False, fileLogLvl=None): |
| 559 | # send critical log messages to stdout | 557 | # send critical log messages to stdout |
| 560 | logStream = logging.StreamHandler() | 558 | logStream = logging.StreamHandler() |
| 561 | logStream.setLevel(STDOUT_LOGLVL) | 559 | logStream.setLevel(STDOUT_LOGLVL) |
| @@ -564,7 +562,7 @@ class Core: | |||
| 564 | log = logging.getLogger("AVP") | 562 | log = logging.getLogger("AVP") |
| 565 | log.addHandler(logStream) | 563 | log.addHandler(logStream) |
| 566 | 564 | ||
| 567 | if FILE_LOGLVL is not None: | 565 | if fileLogLvl is not None: |
| 568 | # write log files as well! | 566 | # write log files as well! |
| 569 | Core.logEnabled = True | 567 | Core.logEnabled = True |
| 570 | logFilename = os.path.join(Core.logDir, "avp_debug.log") | 568 | logFilename = os.path.join(Core.logDir, "avp_debug.log") |
| @@ -576,9 +574,9 @@ class Core: | |||
| 576 | os.remove(log_) | 574 | os.remove(log_) |
| 577 | 575 | ||
| 578 | logFile = logging.FileHandler(logFilename, delay=True) | 576 | logFile = logging.FileHandler(logFilename, delay=True) |
| 579 | logFile.setLevel(FILE_LOGLVL) | 577 | logFile.setLevel(fileLogLvl) |
| 580 | libLogFile = logging.FileHandler(libLogFilename, delay=True) | 578 | libLogFile = logging.FileHandler(libLogFilename, delay=True) |
| 581 | libLogFile.setLevel(FILE_LIBLOGLVL) | 579 | libLogFile.setLevel(fileLogLvl) |
| 582 | fileFormatter = logging.Formatter( | 580 | fileFormatter = logging.Formatter( |
| 583 | "[%(asctime)s] %(threadName)-10.10s %(name)-23.23s %(levelname)s: " | 581 | "[%(asctime)s] %(threadName)-10.10s %(name)-23.23s %(levelname)s: " |
| 584 | "%(message)s" | 582 | "%(message)s" |
