From 087a1baf57f64be29703447d4dd15f238a00d9a1 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 23 Feb 2020 23:17:16 +0400 Subject: Added docker and reworked logging. --- botlogging.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 botlogging.py (limited to 'botlogging.py') 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 -- cgit v1.2.3