Private
Public Access
1
0

switching back to own loggn

This commit is contained in:
Sander Roosendaal
2021-05-20 20:03:04 +02:00
parent affc306b18
commit 1eaabd49a8
2 changed files with 11 additions and 18 deletions

View File

@@ -3,14 +3,6 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
logging.basicConfig(
filename='debuglog.log',
level=logging.DEBUG,
format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p'
)
# The interactions with the Concept2 logbook API
# All C2 related functions should be defined here
# (There is still some stuff defined directly in views.py. Need to

View File

@@ -36,13 +36,6 @@ from iso8601 import ParseError
from json.decoder import JSONDecodeError
import logging
logging.basicConfig(
filename='debuglog.log',
level=logging.CRITICAL,
format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p'
)
from matplotlib.backends.backend_agg import FigureCanvas
#from matplotlib.backends.backend_cairo import FigureCanvasCairo as FigureCanvas
@@ -132,6 +125,14 @@ from rowers.courseutils import (
InvalidTrajectoryError
)
def dologging(s):
tstamp = time.localtime()
timestamp = time.strftime('%b-%d-%Y %H:%M:%S', tstamp)
with open('debuglog.log','a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write(s)
# Concept2 logbook sends over split data for each interval
# We use it here to generate a custom summary
@@ -3006,8 +3007,8 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,defaulttimezone
weightclass = data['weight_class']
s = 'User {userid}, C2 ID {c2id}'.format(userid=userid,c2id=c2id)
logging.critical(s)
logging.critical(data)
dologging(s)
dologging(json.dumps(data))
try:
title = data['name']
@@ -3037,7 +3038,7 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,defaulttimezone
s = 'Time zone {timezone}, stardatetime {startdatetime}, duration {duration}'.format(
timezone=timezone,startdatetime=startdatetime,
duration=duration)
logging.critical(s)
dologging(s)