So we can set output to onle the message without any information (NONE),
only level (BARE), time and level (MINIMAL), time, file, line and level (CONDENSED) or
(ALL) full information.
Has the following settings
TIME, TIME_SECONDS, TIME_MILLISECONDS, TIME_MICROSECONDS: enable time output in different formats
TIME and TIME_MILLISECONDS are equivalent, if multiple are set the smallest precision wins
TIMEZONE: add time zone to time output
NAME: log group name
FILE: short file name
FUNCTION: function name
LINENO: line number
There is a class with quick grouped settings
ConsoleFormatSettings
ALL: all options enabled, time is in milliseconds
CONDENSED: time without time zone, file and line number
MINIMAL: only time without time zone
BARE: only the message, no other info
"console_format_type" with "normal", "condensed", "minimal" options
This sets the format of the console output, controlling the amount of detail shown.
normal show log title, file, function and line number
condensed show file and line number only
minimal shows only timestamp, log level and message
Default is normal
"console_iso_precision" with "seconds", "milliseconds", "microseconds" options
This sets the precision of the ISO timestamp in console logs.
Default is milliseconds
The timestamp output is now ISO8601 formatatted with time zone.
This Logger class can be used after the main Log class has been setup, eg in workers
inside pool/fork/thread runs
A new parent class holds all the public methods
init Logger class with "get_logger_settings" or with a dictionary Type LoggerInit that has
logger with type logging.Logger as mandatory and optional Queue entry
When calling log.exception it automatically writes a short message to the console as error
This error message is tagged <=EXCEPTION> and contains only the message without the stack trace
In the settings checker, if a regex_clean is set as None then we will abort the script with error
if the regex is not matching
Add regex check for email basic
Also add a regex_constants list with regex entries (not compiled and compiled)
Add levels for ALERT, EMERGENCY to be syslog compatible
Add direct wrappers for all, but they are not yet fully usable because the stack fix is not yet implemented
Add a new debug helepr to get the stack as a string
Add flush for queue flushing
Add set/get level for handler
Allow adding handlers during launch, handlers cannot be added afterwards at the moment
Add testing for LoggingLevel enum
Add all logging levels as Enum class type (same as for the PHP CoreLibs Logging)
Add a new method to get the log level as int with fallback via the LoggingLevel Enum
in the QueueLister launcher add "respect_handler_level=True" so it respects the previous set log levels per handler
Also split all logging tests into their own file
enables Queues if multiprocessing.Queue() is set in the "log_queue" setting
Now a logger "Log.init_worker_logging" can be attached to the ProcessPoolExecutor,
the init args must be the log_queue set
example:
```py
with concurrent.futures.ProcessPoolExecutor(
max_workers=max_forks,
initializer=Log.init_worker_logging,
initargs=(log_queue,)
) as executor:
````
Move all settings into a settings argument, the structure is defined in LogSettings.
Default settings are in Log.DEFAULT_LOG_SETTINGS
Only log path and log name are parameters
Color output for console is on default enabled, disable via "console_color_output_enabled"
The complete console output can be stopped with "console_enabled"