Improved logging

This commit is contained in:
Jacob Henry
2019-03-10 01:12:56 -05:00
parent d2de2b8da8
commit 63e4f5af57
8 changed files with 45 additions and 31 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
import logging
from dataclasses import dataclass
from typing import List, Match, Callable, TypeVar, Optional, Iterable, Any, Coroutine
@@ -25,7 +26,7 @@ async def alert_user(brother: scroll_util.Brother, saywhat: str) -> None:
# Warn if we never find
if not succ:
print("Warning: unable to find dm for brother {}".format(brother))
logging.warning("Unable to find dm conversation for brother {}".format(brother))
# Generic type
+4 -3
View File
@@ -1,4 +1,5 @@
import asyncio
import logging
from datetime import datetime
from typing import Optional, List
@@ -102,7 +103,7 @@ class RemindJobs(hooks.Passive, JobNotifier):
assigns: List[house_management.JobAssignment] = [a for a in assigns if self.is_job_valid(a)]
# Now, we want to nag each person. If we don't actually know who they are, so be it.
print("Reminding people who haven't yet done their jobs.")
logging.info("Scheduled reminding people who haven't yet done their jobs.")
for a in assigns:
# Get the relevant slack ids
assignee_ids = await identifier.lookup_brother_userids(a.assignee)
@@ -116,7 +117,7 @@ class RemindJobs(hooks.Passive, JobNotifier):
# Warn on failure
if not success:
print("Tried to nag {} but couldn't find their slack id".format(a.assignee.name))
logging.warning("Tried to nag {} but couldn't find their slack id".format(a.assignee.name))
# Take a break to ensure no double-shots
await asyncio.sleep(10)
@@ -204,7 +205,7 @@ class TestPassive(hooks.Passive):
client.get_slack().add_hook(listener)
# Iterate editing the message every n seconds, for quite some time
for i in range(120):
for i in range(10):
make_interactive_msg()
await asyncio.sleep(post_interval)