mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add queue logging
This commit is contained in:
parent
4447fdfdff
commit
d2b738f857
@ -23,6 +23,7 @@ from app.classes.web.tornado_handler import Webserver
|
|||||||
from app.classes.shared.websocket_manager import WebSocketManager
|
from app.classes.shared.websocket_manager import WebSocketManager
|
||||||
|
|
||||||
logger = logging.getLogger("apscheduler")
|
logger = logging.getLogger("apscheduler")
|
||||||
|
command_log = logging.getLogger("cmd_queue")
|
||||||
scheduler_intervals = {
|
scheduler_intervals = {
|
||||||
"seconds",
|
"seconds",
|
||||||
"minutes",
|
"minutes",
|
||||||
@ -94,7 +95,15 @@ class TasksManager:
|
|||||||
def command_watcher(self):
|
def command_watcher(self):
|
||||||
while True:
|
while True:
|
||||||
# select any commands waiting to be processed
|
# select any commands waiting to be processed
|
||||||
|
command_log.info(
|
||||||
|
"Queue currently has "
|
||||||
|
f"{self.controller.management.command_queue.qsize()} queued commands."
|
||||||
|
)
|
||||||
if not self.controller.management.command_queue.empty():
|
if not self.controller.management.command_queue.empty():
|
||||||
|
command_log.info(
|
||||||
|
"Current queued commands: "
|
||||||
|
f"{list(self.controller.management.command_queue.queue)}"
|
||||||
|
)
|
||||||
cmd = self.controller.management.command_queue.get()
|
cmd = self.controller.management.command_queue.get()
|
||||||
try:
|
try:
|
||||||
svr = self.controller.servers.get_server_instance_by_id(
|
svr = self.controller.servers.get_server_instance_by_id(
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"format": "%(asctime)s - [AUTH] - %(levelname)s - %(message)s"
|
"format": "%(asctime)s - [AUTH] - %(levelname)s - %(message)s"
|
||||||
|
},
|
||||||
|
"cmd_queue": {
|
||||||
|
"format": "%(asctime)s - [CMD_QUEUE] - %(levelname)s - %(message)s"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"handlers": {
|
"handlers": {
|
||||||
@ -59,6 +62,14 @@
|
|||||||
"maxBytes": 10485760,
|
"maxBytes": 10485760,
|
||||||
"backupCount": 20,
|
"backupCount": 20,
|
||||||
"encoding": "utf8"
|
"encoding": "utf8"
|
||||||
|
},
|
||||||
|
"cmd_queue_file_handler": {
|
||||||
|
"class": "logging.handlers.RotatingFileHandler",
|
||||||
|
"formatter": "auth",
|
||||||
|
"filename": "logs/cmd_queue.log",
|
||||||
|
"maxBytes": 10485760,
|
||||||
|
"backupCount": 20,
|
||||||
|
"encoding": "utf8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"loggers": {
|
"loggers": {
|
||||||
@ -90,6 +101,13 @@
|
|||||||
"auth_file_handler"
|
"auth_file_handler"
|
||||||
],
|
],
|
||||||
"propagate": false
|
"propagate": false
|
||||||
|
},
|
||||||
|
"cmd_queue": {
|
||||||
|
"level": "INFO",
|
||||||
|
"handlers": [
|
||||||
|
"cmd_queue_file_handler"
|
||||||
|
],
|
||||||
|
"propagate": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user