kython.klogging

- move to core
- add a proper description why it's useful
- make default level INFO
- use HPI_LOGS variable for easier log level control (abdc6df1ea)
This commit is contained in:
Dima Gerasimov 2020-10-29 01:05:49 +00:00 committed by karlicoss
parent a946e23dd3
commit cc127f1876
5 changed files with 95 additions and 70 deletions

View file

@ -6,10 +6,12 @@ from typing import Optional, NamedTuple, Iterable, Set, Tuple
import pytz
from ..core import warn_if_empty
from ..core import warn_if_empty, LazyLogger
from ..core.error import Res
logger = LazyLogger(__name__)
class Event(NamedTuple):
dt: datetime
summary: str
@ -23,8 +25,6 @@ Results = Iterable[Res[Event]]
@warn_if_empty
def merge_events(*sources: Results) -> Results:
from ..kython.klogging import LazyLogger
logger = LazyLogger(__name__)
from itertools import chain
emitted: Set[Tuple[datetime, str]] = set()
for e in chain(*sources):