ISEPOS-2280 Added base loggers scripts #1

Open
ymlesni wants to merge 8 commits from ymlesni/shared-snippets:feature/ISEPOS-2280-mechanizm-raportowania-informacji-z-aplikacji-do-pliku-z-logami into main
Showing only changes of commit 0d0285a296 - Show all commits

View File

@ -11,7 +11,7 @@ def getDefaultLogger(name):
Retrieves or creates a logger with the specified name and sets it up with a file handler.
The logger is configured to write log messages to the file path specified by the
'DEFAULT_LOG_PATH' environment variable. It uses the 'INFO' level as the default
'APP_LOG_FILE' environment variable. It uses the 'INFO' level as the default
Outdated
Review

I think the name was changed to 'APP_LOG_FILE'

I think the name was changed to 'APP_LOG_FILE'
logging level and writes log entries in the following format:
'YYYY-MM-DD HH:MM:SS,ms LEVEL logger_name message'
@ -30,13 +30,13 @@ def getDefaultLogger(name):
--------
logger : logging.Logger
A logger instance with the specified name. The logger is configured with a
file handler that writes to the file specified by the 'DEFAULT_LOG_PATH'
file handler that writes to the file specified by the 'APP_LOG_FILE'
environment variable.
Raises:
-------
KeyError:
If the 'DEFAULT_LOG_PATH' environment variable is not set.
If the 'APP_LOG_FILE' environment variable is not set.
Review

Here, again, the name of the variable should be updated. But I thought also that instead of throwing an error, we might use some default file name, to allow users to run the app also outside of the platform. But, I would set the default log file name to something different than "application.log", so that we know that we could notice if something is wrong with setting the environment variable.

Here, again, the name of the variable should be updated. But I thought also that instead of throwing an error, we might use some default file name, to allow users to run the app also outside of the platform. But, I would set the default log file name to something different than "application.log", so that we know that we could notice if something is wrong with setting the environment variable.
Example:
--------