aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2023-06-06 13:06:06 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2023-06-06 13:06:06 +0100
commit0cb69efde8e73a0331a267615f046b9d22579476 (patch)
tree47e0f5966d364565e72e2c91a16d4fd45f8d10b2
parent790ca4d3083f8226360dc6eebe35a454f317bb15 (diff)
downloadSmallYTChannelBot-0cb69efde8e73a0331a267615f046b9d22579476.tar.gz
SmallYTChannelBot-0cb69efde8e73a0331a267615f046b9d22579476.zip
Added API logging
-rwxr-xr-x.gitignore1
-rw-r--r--docker-compose.yml2
-rwxr-xr-xsubreddit.py24
3 files changed, 19 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 09dcb3e..2107721 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+logs/
login.py
graph.png
pid.txt
diff --git a/docker-compose.yml b/docker-compose.yml
index 9624bc9..4cd338c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -7,6 +7,8 @@ services:
dockerfile: Dockerfile
image: jwansek/smallytchannelbot
network_mode: host
+ volumes:
+ - ./logs/:/logs/
cron:
build:
context: .
diff --git a/subreddit.py b/subreddit.py
index 497359f..e92c1d9 100755
--- a/subreddit.py
+++ b/subreddit.py
@@ -27,19 +27,27 @@ FREE_FLAIRS = CONFIG["free_flairs"]
IMGUR = ImgurClient(**CONFIG["imgurapi"])
-logging.basicConfig(
- format = "%(process)s\t[%(asctime)s]\t%(message)s",
- level = logging.INFO,
- handlers=[
- logging.FileHandler("actions.log"),
- logging.StreamHandler()
- ])
+# logging.basicConfig(
+# format = "%(process)s\t[%(asctime)s]\t%(message)s",
+# level = logging.INFO,
+# handlers=[
+# logging.FileHandler("actions.log"),
+# logging.StreamHandler()
+# ])
+
+handler = logging.FileHandler("/logs/api.log")
+handler.setLevel(logging.DEBUG)
+for logger_name in ("praw", "prawcore"):
+ logger = logging.getLogger(logger_name)
+ logger.setLevel(logging.DEBUG)
+ logger.addHandler(handler)
def get_time():
return time.strftime("%b %d %Y %H:%M:%S", time.gmtime())
def display(message, concerning = None):
- logging.info(message)
+ # logging.info(message)
+ print(message)
#yes it'd be prettier to do this with a logging.Handler, but alas
#due to `concerning` it'd be more complicated than doing it like this