Better logs and better timings
This commit is contained in:
parent
39ae1ec038
commit
5613b1043c
@ -10,10 +10,19 @@ import persistence.main
|
|||||||
# various
|
# various
|
||||||
import logging
|
import logging
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
import os
|
||||||
|
|
||||||
|
if os.name == "nt":
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
logging.basicConfig(
|
||||||
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||||
|
level=logging.INFO,
|
||||||
|
filename='persistence/complete.log',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Launcher():
|
class Launcher():
|
||||||
"""Launches all other submodules"""
|
"""Launches all other submodules"""
|
||||||
|
13
t.py
13
t.py
@ -1,13 +0,0 @@
|
|||||||
import bot2.main
|
|
||||||
import persistence.main
|
|
||||||
|
|
||||||
import logging
|
|
||||||
logging.basicConfig(
|
|
||||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
||||||
level=logging.INFO,
|
|
||||||
#filename='persistence/complete.log',
|
|
||||||
)
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
prst = persistence.main.PersistentDict("persistence/prst.json")
|
|
||||||
|
|
||||||
test = bot2.main.ChatBot("Test", ".1", "HW", prst, logger)
|
|
@ -36,7 +36,6 @@ class ClockWrapper(Wrapper):
|
|||||||
def START(self): # I prefer the name tick_tack
|
def START(self): # I prefer the name tick_tack
|
||||||
"""Runs the showing of the clock-face periodically: update every minute"""
|
"""Runs the showing of the clock-face periodically: update every minute"""
|
||||||
def perform_loop():
|
def perform_loop():
|
||||||
logger.warning("NEW TIME")
|
|
||||||
t = int(datetime.datetime.now().strftime("%H%M"))
|
t = int(datetime.datetime.now().strftime("%H%M"))
|
||||||
|
|
||||||
if t % 5 == 0:
|
if t % 5 == 0:
|
||||||
@ -45,7 +44,6 @@ class ClockWrapper(Wrapper):
|
|||||||
|
|
||||||
if weather != self.weather_raw and len(weather) != 0:
|
if weather != self.weather_raw and len(weather) != 0:
|
||||||
td = weather[1]
|
td = weather[1]
|
||||||
|
|
||||||
low = td["temps"][0]
|
low = td["temps"][0]
|
||||||
high = td["temps"][1]
|
high = td["temps"][1]
|
||||||
self.weather["weather"] = td["short"]
|
self.weather["weather"] = td["short"]
|
||||||
@ -63,15 +61,15 @@ class ClockWrapper(Wrapper):
|
|||||||
next = "weather"
|
next = "weather"
|
||||||
self.weather["show"] = next
|
self.weather["show"] = next
|
||||||
|
|
||||||
self.prev_time = datetime.datetime.now().strftime("%H%M")
|
|
||||||
|
|
||||||
self.own.set_face(self.weather)
|
self.own.set_face(self.weather)
|
||||||
|
|
||||||
|
perform_loop()
|
||||||
|
while datetime.datetime.now().strftime("%H%M%S")[-2:] != "00":
|
||||||
|
pass
|
||||||
RepeatedTimer(60, perform_loop)
|
RepeatedTimer(60, perform_loop)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BotWrapper(Wrapper):
|
class BotWrapper(Wrapper):
|
||||||
"""Wrapper for the BOT-functionality"""
|
"""Wrapper for the BOT-functionality"""
|
||||||
def __init__(self, own_module, *other_modules):
|
def __init__(self, own_module, *other_modules):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user