[fix] Changing logging to stderr for the Geonames scripts

This commit is contained in:
Al
2015-06-14 15:38:52 -04:00
parent e3dffc177c
commit 43e023077c
2 changed files with 3 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ from geodata.log import *
from itertools import islice, chain
log_to_stdout()
log_to_file(sys.stderr)
logger = logging.getLogger('geonames.sqlite')
GEONAMES_DB_NAME = 'geonames.db'

View File

@@ -2,8 +2,8 @@ import logging
import sys
def log_to_stdout(level=logging.INFO):
handler = logging.StreamHandler(sys.stdout)
def log_to_file(f, level=logging.INFO):
handler = logging.StreamHandler(f)
formatter = logging.Formatter('%(asctime)s %(levelname)s [%(name)s]: %(message)s')
handler.setFormatter(formatter)
logging.root.addHandler(handler)