database: Add unsafe shutdowns to the log rollover
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
5f9706f6be
commit
ac55b95c1d
@ -99,19 +99,20 @@ class MoonrakerDatabase:
|
|||||||
"moonraker", "database.protected_namespaces", ["moonraker"]))
|
"moonraker", "database.protected_namespaces", ["moonraker"]))
|
||||||
self.forbidden_namespaces = set(self.get_item(
|
self.forbidden_namespaces = set(self.get_item(
|
||||||
"moonraker", "database.forbidden_namespaces", []))
|
"moonraker", "database.forbidden_namespaces", []))
|
||||||
|
# Track debug access and unsafe shutdowns
|
||||||
debug_counter: int = self.get_item(
|
debug_counter: int = self.get_item(
|
||||||
"moonraker", "database.debug_counter", 0)
|
"moonraker", "database.debug_counter", 0)
|
||||||
if self.enable_debug:
|
if self.enable_debug:
|
||||||
debug_counter += 1
|
debug_counter += 1
|
||||||
self.insert_item("moonraker", "database.debug_counter",
|
self.insert_item("moonraker", "database.debug_counter",
|
||||||
debug_counter)
|
debug_counter)
|
||||||
if debug_counter:
|
|
||||||
logging.info(f"Database Debug Count: {debug_counter}")
|
|
||||||
|
|
||||||
# Track unsafe shutdowns
|
|
||||||
unsafe_shutdowns: int = self.get_item(
|
unsafe_shutdowns: int = self.get_item(
|
||||||
"moonraker", "database.unsafe_shutdowns", 0)
|
"moonraker", "database.unsafe_shutdowns", 0)
|
||||||
logging.info(f"Unsafe Shutdown Count: {unsafe_shutdowns}")
|
msg = f"Unsafe Shutdown Count: {unsafe_shutdowns}"
|
||||||
|
if debug_counter:
|
||||||
|
msg += f"; Database Debug Count: {debug_counter}"
|
||||||
|
self.server.add_log_rollover_item("database", msg)
|
||||||
|
|
||||||
# Increment unsafe shutdown counter. This will be reset if
|
# Increment unsafe shutdown counter. This will be reset if
|
||||||
# moonraker is safely restarted
|
# moonraker is safely restarted
|
||||||
self.insert_item("moonraker", "database.unsafe_shutdowns",
|
self.insert_item("moonraker", "database.unsafe_shutdowns",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user