mirror of
https://github.com/gyptazy/ProxLB.git
synced 2026-04-06 04:41:58 +02:00
@@ -1,2 +1,2 @@
|
||||
fix:
|
||||
- add handler to log messages with severity less than info to the screen when there is no systemd integration, for instance, inside a docker container. [#185]
|
||||
- add handler to log messages with severity less than info to the screen when there is no systemd integration, for instance, inside a docker container (by @glitchvern) [#185]
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
fixed:
|
||||
- allow the use of minutes instead of hours and only accept hours or minutes in the format [#187]
|
||||
- allow the use of minutes instead of hours and only accept hours or minutes in the format (by @glitchvern) [#187]
|
||||
|
||||
@@ -83,26 +83,22 @@ class SystemdLogger:
|
||||
self.logger = logging.getLogger(name)
|
||||
self.logger.setLevel(level)
|
||||
|
||||
# Create a JournalHandler for systemd integration if this
|
||||
# is supported on the underlying OS.
|
||||
# Create a logging handler depending on the
|
||||
# capabilities of the underlying OS where systemd
|
||||
# logging is preferred.
|
||||
if SYSTEMD_PRESENT:
|
||||
# Add a JournalHandler for systemd integration
|
||||
journal_handler = JournalHandler()
|
||||
journal_handler.setLevel(level)
|
||||
# Set a formatter to include the logger's name and log message
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
journal_handler.setFormatter(formatter)
|
||||
# Add handler to logger
|
||||
self.logger.addHandler(journal_handler)
|
||||
handler = JournalHandler()
|
||||
else:
|
||||
# Add a handler for no systemd integration
|
||||
# Add a stdout handler as a fallback
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setLevel(level)
|
||||
# Set a formatter to include the logger's name and log message
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
# Add handler to logger
|
||||
self.logger.addHandler(handler)
|
||||
|
||||
handler.setLevel(level)
|
||||
# Set a formatter to include the logger's name and log message
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
# Add handler to logger
|
||||
self.logger.addHandler(handler)
|
||||
|
||||
def set_log_level(self, level: str) -> None:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user