fixes with logging

This commit is contained in:
Daniel Tsvetkov 2020-03-17 18:43:35 +01:00
parent e99b0eca50
commit efb60782e9
6 changed files with 10 additions and 6 deletions

1
data/.cache.csv Normal file
View File

@ -0,0 +1 @@
zurich,47.3666667,8.5500002
1 zurich 47.3666667 8.5500002

View File

@ -29,6 +29,7 @@ python-dateutil==2.8.1
python-Levenshtein==0.12.0
pytz==2019.3
regex==2020.1.8
scalpl==0.3.0
six==1.14.0
timezonefinder==4.2.0
traitlets==4.3.3

4
src/tww/common.py Normal file
View File

@ -0,0 +1,4 @@
import logging
logging.basicConfig()
logger = logging.getLogger()

View File

@ -21,5 +21,5 @@
var radius = canvas.height / 2;
ctx.translate(radius, radius);
radius = radius * 0.90;
drawClock(ctx, radius, "{{dst_dt.iso8601_time}}");
drawClock(ctx, radius, "{{dt.iso8601_time}}");
</script>

View File

@ -1,7 +1,6 @@
import argparse
import json
import locale
import logging
import re
from datetime import datetime
@ -12,6 +11,7 @@ from localization import setlocale, resolve_locale
from tww import ISO_FORMAT, time_to_emoji, time_ago, workday_diff, workhours_diff, td_remainders, td_totals, td_iso8601
from tww import resolve_timezone, dateparser_parse_dt, get_utcnow, get_s_since_epoch, get_ms_since_epoch, \
dt_tz_translation, get_local_now, query_to_format_result
from common import logger
custom_locale = resolve_locale()
@ -314,10 +314,6 @@ def parse_args():
return args
logging.basicConfig()
logger = logging.getLogger()
def setup_logging_level(debug=False):
log_level = logging.DEBUG if debug else logging.ERROR
logger.setLevel(log_level)

View File

@ -29,6 +29,8 @@ from pytz.exceptions import UnknownTimeZoneError
from timezonefinder import TimezoneFinder
from word2number import w2n
from common import logger
FUZZ_THRESHOLD = 70
ISO_FORMAT = '%Y-%m-%dT%H:%M:%S%z'
DEFAULT_FORMAT = '%Y-%m-%d %H:%M:%S%z'