Commit d21fbbe5 authored by Aaron Hill's avatar Aaron Hill Committed by GitHub
Browse files

Merge pull request #779 from hhromic/proper-logging

replace raw print() calls with proper logging-based calls
parents a7cc96f6 cb050623
...@@ -158,7 +158,7 @@ def bind_api(**config): ...@@ -158,7 +158,7 @@ def bind_api(**config):
sleep_time = self._reset_time - int(time.time()) sleep_time = self._reset_time - int(time.time())
if sleep_time > 0: if sleep_time > 0:
if self.wait_on_rate_limit_notify: if self.wait_on_rate_limit_notify:
print("Rate limit reached. Sleeping for:", sleep_time) log.warning("Rate limit reached. Sleeping for: %d" % sleep_time)
time.sleep(sleep_time + 5) # sleep for few extra sec time.sleep(sleep_time + 5) # sleep for few extra sec
# if self.wait_on_rate_limit and self._reset_time is not None and \ # if self.wait_on_rate_limit and self._reset_time is not None and \
...@@ -166,7 +166,7 @@ def bind_api(**config): ...@@ -166,7 +166,7 @@ def bind_api(**config):
# sleep_time = self._reset_time - int(time.time()) # sleep_time = self._reset_time - int(time.time())
# if sleep_time > 0: # if sleep_time > 0:
# if self.wait_on_rate_limit_notify: # if self.wait_on_rate_limit_notify:
# print("Rate limit reached. Sleeping for: " + str(sleep_time)) # log.warning("Rate limit reached. Sleeping for: %d" % sleep_time)
# time.sleep(sleep_time + 5) # sleep for few extra sec # time.sleep(sleep_time + 5) # sleep for few extra sec
# Apply authentication # Apply authentication
......
...@@ -8,6 +8,7 @@ import time ...@@ -8,6 +8,7 @@ import time
import datetime import datetime
import threading import threading
import os import os
import logging
try: try:
import cPickle as pickle import cPickle as pickle
...@@ -27,6 +28,7 @@ except ImportError: ...@@ -27,6 +28,7 @@ except ImportError:
# TODO: use win32file # TODO: use win32file
pass pass
log = logging.getLogger('tweepy.cache')
class Cache(object): class Cache(object):
"""Cache interface""" """Cache interface"""
...@@ -157,7 +159,7 @@ class FileCache(Cache): ...@@ -157,7 +159,7 @@ class FileCache(Cache):
self._lock_file = self._lock_file_win32 self._lock_file = self._lock_file_win32
self._unlock_file = self._unlock_file_win32 self._unlock_file = self._unlock_file_win32
else: else:
print('Warning! FileCache locking not supported on this system!') log.warning('FileCache locking not supported on this system!')
self._lock_file = self._lock_file_dummy self._lock_file = self._lock_file_dummy
self._unlock_file = self._unlock_file_dummy self._unlock_file = self._unlock_file_dummy
......
Markdown is supported
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