6 7
This commit is contained in:
25
cvmsentry.py
25
cvmsentry.py
@@ -14,11 +14,11 @@ LOG_LEVEL = getattr(config, "log_level", "INFO")
|
|||||||
if not os.path.exists("logs"):
|
if not os.path.exists("logs"):
|
||||||
os.makedirs("logs")
|
os.makedirs("logs")
|
||||||
log_format = logging.Formatter(
|
log_format = logging.Formatter(
|
||||||
"[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
"[%(asctime)s:%(name)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
||||||
)
|
)
|
||||||
stdout_handler = logging.StreamHandler(sys.stdout)
|
stdout_handler = logging.StreamHandler(sys.stdout)
|
||||||
stdout_handler.setFormatter(log_format)
|
stdout_handler.setFormatter(log_format)
|
||||||
log = logging.getLogger("cvmsentry")
|
log = logging.getLogger("CVMSentry")
|
||||||
log.setLevel(LOG_LEVEL)
|
log.setLevel(LOG_LEVEL)
|
||||||
log.addHandler(stdout_handler)
|
log.addHandler(stdout_handler)
|
||||||
|
|
||||||
@@ -123,16 +123,17 @@ async def connect(vm_name: str):
|
|||||||
log_data[utc_day] = []
|
log_data[utc_day] = []
|
||||||
|
|
||||||
if backlog:
|
if backlog:
|
||||||
for i in range(0, len(backlog), 2):
|
pass
|
||||||
backlog_user = backlog[i]
|
# for i in range(0, len(backlog), 2):
|
||||||
backlog_message = backlog[i + 1]
|
# backlog_user = backlog[i]
|
||||||
if not any(entry["message"] == backlog_message and entry["username"] == backlog_user for entry in log_data[utc_day]):
|
# backlog_message = backlog[i + 1]
|
||||||
log.info(f"[{vm_name} - {backlog_user} (backlog)]: {backlog_message}")
|
# if not any(entry["message"] == backlog_message and entry["username"] == backlog_user for entry in log_data[utc_day]):
|
||||||
log_data[utc_day].append({
|
# log.info(f"[{vm_name} - {backlog_user} (backlog)]: {backlog_message}")
|
||||||
"timestamp": timestamp,
|
# log_data[utc_day].append({
|
||||||
"username": backlog_user,
|
# "timestamp": timestamp,
|
||||||
"message": backlog_message
|
# "username": backlog_user,
|
||||||
})
|
# "message": backlog_message
|
||||||
|
# })
|
||||||
|
|
||||||
log_data[utc_day].append({
|
log_data[utc_day].append({
|
||||||
"timestamp": timestamp,
|
"timestamp": timestamp,
|
||||||
|
|||||||
Reference in New Issue
Block a user