switching back to own loggn
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user