diff --git a/configs/logging_config.ini b/configs/logging_config.ini deleted file mode 100644 index 67b6ddd..0000000 --- a/configs/logging_config.ini +++ /dev/null @@ -1,36 +0,0 @@ -[loggers] -keys=root - -[handlers] -keys=stream_handler, rfile_handler - -[formatters] -keys=brief, verbose - -[logger_root] -level=DEBUG -handlers=stream_handler, rfile_handler - -[handler_stream_handler] -class=StreamHandler -level=DEBUG -formatter=brief -args=(sys.stderr,) - -[handler_rfile_handler] -class=handlers.RotatingFileHandler -level=DEBUG -formatter=verbose -mode=a -backupCount=1 -encoding=None -maxBytes=1024 -delay=0 -args=('%(logfilename)s',) - -[formatter_brief] -datefmt=%Y-%m-%d %H:%M -format=%(levelname)s| %(message)s - -[formatter_verbose] -format=%(asctime)s | %(levelname)s| %(name)s | %(message)s \ No newline at end of file diff --git a/configs/version.ini b/configs/version.ini deleted file mode 100644 index afaf360..0000000 --- a/configs/version.ini +++ /dev/null @@ -1 +0,0 @@ -1.0.0 \ No newline at end of file diff --git a/images/dsPlayblast.ico b/dsPlayblast/images/dsPlayblast.ico similarity index 100% rename from images/dsPlayblast.ico rename to dsPlayblast/images/dsPlayblast.ico diff --git a/dsPlayblast/loggingFn.py b/dsPlayblast/loggingFn.py index 57e2f57..03eb810 100644 --- a/dsPlayblast/loggingFn.py +++ b/dsPlayblast/loggingFn.py @@ -1,12 +1,27 @@ import logging.config +import logging.handlers from dsPlayblast import util def setup_logging(): log_file = "playblast.log" - config_file = util.resource_path("configs/logging_config.ini") - logging.config.fileConfig(config_file, defaults={'logfilename': log_file}, disable_existing_loggers=False) + # Formatters + brief_formatter = logging.Formatter(fmt="%(levelname)s | %(message)s", datefmt="%Y-%m-%d %H:%M") + verbose_formatter = logging.Formatter(fmt="%(asctime)s | %(levelname)s | %(name)s | %(message)s") + # Handlers + rfile_handler = logging.handlers.RotatingFileHandler(log_file, mode="a", maxBytes=1024, backupCount=1, delay=0) + rfile_handler.setLevel("DEBUG") + rfile_handler.setFormatter(verbose_formatter) + stream_handler = logging.StreamHandler() + stream_handler.setLevel("DEBUG") + stream_handler.setFormatter(brief_formatter) + + # Root logger + logging.root.setLevel("DEBUG") + logging.root.addHandler(stream_handler) + logging.root.addHandler(rfile_handler) if __name__ == "__main__": - print(util.resource_path("logging_config.ini")) + setup_logging() + logging.root.info("Root logger") diff --git a/make.bat b/make.bat index b4c3cab..f6fab10 100644 --- a/make.bat +++ b/make.bat @@ -1,2 +1,2 @@ -pyinstaller.exe --onedir --windowed --name dsPlayblast --icon=./images/dsPlayblast.ico ./dsPlayblast/main.py +pyinstaller.exe --onedir --windowed --name dsPlayblast --icon=./dsPlayblast/images/dsPlayblast.ico ./dsPlayblast/main.py PAUSE \ No newline at end of file