From a606e483b3a42357778fc3d4979e800e8dd38739 Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Thu, 11 Oct 2018 11:44:28 +0200 Subject: Adding Pale Man, fixing all flake8 issues, converting halloweenify to use aiohttp, fixing broken logging, ignoring irrelevant loggers, and turning the script into a valid module script. --- bot/__init__.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'bot/__init__.py') diff --git a/bot/__init__.py b/bot/__init__.py index 8cbcd121..c2ea4ba0 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -1,8 +1,8 @@ -import os import logging.handlers +import os -# set up logging +# set up logging log_dir = 'log' log_file = log_dir + os.sep + 'hackbot.log' os.makedirs(log_dir, exist_ok=True) @@ -22,9 +22,14 @@ if root.handlers: for handler in root.handlers: root.removeHandler(handler) -# setup new logging configuration -logging.basicConfig(format='%(asctime)s - %(name)s %(levelname)s: %(message)s', datefmt="%D %H:%M:%S", - level=logging.DEBUG, - handlers=[console_handler, file_handler]) +# Silence irrelevant loggers +logging.getLogger("discord").setLevel(logging.ERROR) -logging.info('Logging Process Started') \ No newline at end of file +# setup new logging configuration +logging.basicConfig( + format='%(asctime)s - %(name)s %(levelname)s: %(message)s', + datefmt="%D %H:%M:%S", + level=logging.DEBUG, + handlers=[console_handler, file_handler] +) +logging.getLogger().info('Logging initialization complete') -- cgit v1.2.3 From 9567aec0929ade42e57e677b66da942abc51e59a Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Fri, 12 Oct 2018 01:01:59 +0200 Subject: The app was logging to the wrong directory. This is now fixed. Also silenced websockets logging --- bot/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bot/__init__.py') diff --git a/bot/__init__.py b/bot/__init__.py index c2ea4ba0..c411deb6 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -1,10 +1,11 @@ import logging.handlers import os +from pathlib import Path # set up logging -log_dir = 'log' -log_file = log_dir + os.sep + 'hackbot.log' +log_dir = Path("bot", "log") +log_file = log_dir / "hackbot.log" os.makedirs(log_dir, exist_ok=True) # file handler sets up rotating logs every 5 MB @@ -24,6 +25,7 @@ if root.handlers: # Silence irrelevant loggers logging.getLogger("discord").setLevel(logging.ERROR) +logging.getLogger("websockets").setLevel(logging.ERROR) # setup new logging configuration logging.basicConfig( -- cgit v1.2.3