Add verbose log level.

This commit is contained in:
redxef 2023-11-14 15:59:57 +01:00
parent 437ad585ac
commit 89b769088e
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921
2 changed files with 4 additions and 1 deletions

View file

@ -161,7 +161,6 @@ class Wordpress(Sink, Adapter):
return nonce['value'] return nonce['value']
def post_events(self, events, start: datetime.datetime | None=None, until: datetime.timedelta | None=None): def post_events(self, events, start: datetime.datetime | None=None, until: datetime.timedelta | None=None):
metadata = self.calendar_metadata.to_dict() metadata = self.calendar_metadata.to_dict()
data = self._generate_data(events, start=start, until=until) data = self._generate_data(events, start=start, until=until)
update_request = self.session.post( update_request = self.session.post(

View file

@ -13,6 +13,8 @@ import click
import adapters import adapters
from adapters import * from adapters import *
logging.VERBOSE = (logging.DEBUG + logging.INFO) // 2
logger = logging.getLogger(f'wp_cal') logger = logging.getLogger(f'wp_cal')
def range_str_to_timedelta(value): def range_str_to_timedelta(value):
@ -78,6 +80,7 @@ def set_logging_level(level: str):
levels = { levels = {
'NOTSET': logging.NOTSET, 'NOTSET': logging.NOTSET,
'DEBUG': logging.DEBUG, 'DEBUG': logging.DEBUG,
'VERBOSE': logging.VERBOSE,
'INFO': logging.INFO, 'INFO': logging.INFO,
'WARNING': logging.WARNING, 'WARNING': logging.WARNING,
'WARN': logging.WARNING, 'WARN': logging.WARNING,
@ -161,6 +164,7 @@ def main(config, dryrun, level, range):
logger.info('not syncing cancelled events') logger.info('not syncing cancelled events')
events = [e for e in events if e['status'] != 'cancelled'] events = [e for e in events if e['status'] != 'cancelled']
logger.info('syncing %d events', len(events)) logger.info('syncing %d events', len(events))
logger.log(logging.VERBOSE, 'events are: %s', [f"{e.get('summary', '<NO SUMMARY PROVIDED>')} ({e.get('start')})" for e in events])
# post events # post events
if dryrun: if dryrun: