1
0
mirror of http://aero2k.de/t/repos/urlbot-native.git synced 2017-09-06 15:25:38 +02:00

replace local logger() by logging infrastructure

This commit is contained in:
urlbot
2015-06-21 00:50:42 +02:00
parent b2c5a2ce3f
commit 2da78641a7
4 changed files with 70 additions and 77 deletions

View File

@@ -5,7 +5,7 @@ if '__main__' == __name__:
print('''this is a library file, which is not meant to be executed''')
exit(-1)
import sys, time, pickle, os
import sys, time, pickle, os, logging
from local_config import conf
RATE_GLOBAL = 0x01
@@ -21,16 +21,17 @@ basedir = '.'
if 2 == len(sys.argv):
basedir = sys.argv[1]
logging.basicConfig(
level=logging.INFO,
format=sys.argv[0]+' %(asctime)s %(levelname)-8s %(message)s'
)
log = logging.getLogger()
log.plugin = log.info # ... probably fix this sometime (FIXME)
def debug_enabled():
# return True
return False
def logger(severity, message):
# sev = ( 'err', 'warn', 'info' )
# if severity in sev:
args = (sys.argv[0], time.strftime('%Y-%m-%d.%H:%M:%S'), severity, message)
sys.stderr.write('%s %s %s: %s\n' % args)
def conf_save(obj):
with open(conf('persistent_storage'), 'wb') as fd:
return pickle.dump(obj, fd)