summaryrefslogtreecommitdiff
path: root/botlogging.py
diff options
context:
space:
mode:
authorAndrew <saintruler@gmail.com>2020-02-23 23:17:16 +0400
committerAndrew <saintruler@gmail.com>2020-02-23 23:17:16 +0400
commit087a1baf57f64be29703447d4dd15f238a00d9a1 (patch)
tree370924e8a8d7407ea67cb91c96ccf1b228112fc0 /botlogging.py
parent7512932056b1edf82c3c711a9297445ac8c0cc52 (diff)
Added docker and reworked logging.
Diffstat (limited to 'botlogging.py')
-rw-r--r--botlogging.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/botlogging.py b/botlogging.py
new file mode 100644
index 0000000..6dc9d37
--- /dev/null
+++ b/botlogging.py
@@ -0,0 +1,22 @@
+import logging
+
+
+fh = logging.FileHandler("logs/log.log")
+fh.setLevel(logging.DEBUG)
+
+ch = logging.StreamHandler()
+ch.setLevel(logging.DEBUG)
+
+log_format = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
+fh.setFormatter(log_format)
+ch.setFormatter(log_format)
+
+logging.basicConfig(
+ level=logging.DEBUG, handlers=[fh, ch],
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
+)
+
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.DEBUG)
+logger.addHandler(fh)
+logger.addHandler(ch) \ No newline at end of file