Add logging
This commit is contained in:
parent
e9fe6a07d7
commit
873301059d
1 changed files with 12 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import asyncio
|
||||
import datetime
|
||||
from pathlib import Path
|
||||
|
||||
import appdirs
|
||||
|
@ -26,6 +27,17 @@ def write_config(new: dict) -> None:
|
|||
@click.group()
|
||||
def main():
|
||||
"""HDIKY? (How Do I Know You?) - A Matrix utility to find mutual rooms with a user"""
|
||||
import logging
|
||||
now = datetime.datetime.now().date().isoformat()
|
||||
loc = Path(appdirs.user_log_dir("hdiky")) / f"{now}.log"
|
||||
loc.parent.mkdir(parents=True, exist_ok=True)
|
||||
loc.touch()
|
||||
logging.basicConfig(
|
||||
filename=str(loc),
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||
datefmt="%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
|
||||
|
||||
@main.group()
|
||||
|
|
Loading…
Reference in a new issue