58 predict.__name__ = best.name + '.predict'
59
60 rule = '/' + qualified_name + '/predict.json'
61 logger.info('Adding url rule for prediction: %s' % rule)62 app.add_url_rule(rule, view_func=predict)
320 extra_data={"app": env.APP}
321 )
322 except Exception as e:
323 logger.exception('reporting to rollbar: %s' % e)324
325 sys.excepthook = report_exception
326
352 _librato_timer = None
353 _librato_start = None
354 _librato_lock = threading.RLock()
355 logger.info('connected to librato with user: %s' % os.getenv('LIBRATO_USER'))356 except:
357 logger.exception('unable to start librato')
358 report_exception()
127 if other is None:
128 other = datetime.datetime.now()
129 elif other.dtype != 'datetime64[ns]':
130 logger.warning('%s is not a datetime. Converting to datetime64[ns]' % self.column)131 other = pandas.to_datetime(other).astype('datetime64[ns]')
132
133 if series.dtype != 'datetime64[ns]':
131 other = pandas.to_datetime(other).astype('datetime64[ns]')
132
133 if series.dtype != 'datetime64[ns]':
134 logger.warning('%s is not a datetime. Converting to datetime64[ns]' % self.column)135 series = pandas.to_datetime(series).astype('datetime64[ns]')
136
137 age = (other - series)
The logging statement has the call of the form logging.(format_string % (format_args...))
. For such calls, it is recommended to leave string interpolation to the logging method itself and be written as logging.(format_string, format_args...)
so that the program may avoid incurring the cost of the interpolation in those cases in which no message will be logged.
For more details, see PEP 282.
Not Preferred:
logger.info("This is a log message %s %d %d" % (msg, foo, bar))
Preferred:
logger.info("This is a log message %s %d %d", msg, foo, bar)