Commit 738e9ab1 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

tsio: replace prints with log statements (more to come)

parent 1ce37f22fd89
from datetime import datetime
from contextlib import contextmanager
import logging
import pandas as pd
import numpy as np
......@@ -13,6 +14,15 @@ from tshistory import schema
def setuplogging():
logger = logging.getLogger('tshistory.tsio')
return logger
L = setuplogging()
def tojson(ts):
if ts is None:
return None
......@@ -59,7 +69,7 @@ class TimeSerie(object):
assert self._csid or author, 'author is mandatory'
if self._csid and author:
print('author will not be used when in a changeset')'author will not be used when in a changeset')
assert isinstance(newts, pd.Series)
newts = newts[~newts.isnull()] # wipe the the NaNs
......@@ -83,14 +93,14 @@ class TimeSerie(object):
self._complete_insertion_value(value, extra_scalars)
self._finalize_insertion(cnx, csid, name)
print('Fisrt insertion of %s by %s' % (name, author))'Fisrt insertion of %s by %s', name, author)
diff, newsnapshot = self._compute_diff_and_newsnapshot(
cnx, table, newts, **extra_scalars
if diff is None:
print('No difference in %s by %s' % (name, author))'No difference in %s by %s', name, author)
tip_id = self._get_tip_id(cnx, table)
......@@ -111,7 +121,7 @@ class TimeSerie(object):
).where( == tip_id
print('Insertion differential of %s by %s' % (name, author))'Insertion differential of %s by %s', name, author)
def get(self, cnx, name, revision_date=None):
"""Compute and return the serie of a given name
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment