Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Moved logging from file to stream handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sweco-semhul committed Feb 4, 2015
1 parent c746895 commit 1377d05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions config.cfg.in
Expand Up @@ -10,5 +10,4 @@ OAUTH_CLIENT_ID = '%(OAUTH_CLIENT_ID)s'
OAUTH_CLIENT_SECRET = '%(OAUTH_CLIENT_SECRET)s'
OAUTHLIB_INSECURE_TRANSPORT = 'True'
SESSION_SECRET_KEY = '%(SESSION_SECRET_KEY)s'
DEBUG = False
LOG_FILE = 'kitin.log'
DEBUG = False
15 changes: 5 additions & 10 deletions kitin.py
Expand Up @@ -432,11 +432,6 @@ def chunk_number(num):
oparser.add_option('-L', '--fakelogin', action='store_true', default=False)
opts, args = oparser.parse_args()

if 'LOG_FILE' in app.config:
log_file = app.config['LOG_FILE']
else:
log_file = 'kitin.log'

log_level = logging.INFO
if 'DEBUG' in app.config:
app.debug = app.config['DEBUG']
Expand All @@ -445,11 +440,11 @@ def chunk_number(num):
if opts.debug:
app.debug = opts.debug
else:
handler = RotatingFileHandler(log_file, maxBytes=10000, backupCount=1)
formatter = logging.Formatter("[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
handler.setLevel(log_level)
handler.setFormatter(formatter)
app.logger.addHandler(handler)
logFormatter = logging.Formatter("%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]")
consoleHandler = logging.StreamHandler()
consoleHandler.setFormatter(logFormatter)
logging.getLogger().addHandler(consoleHandler)


app.fakelogin = opts.fakelogin
app.run(host='0.0.0.0')

0 comments on commit 1377d05

Please sign in to comment.