Commit ce66e4ecc697c7a87e8e73d19eebbdd385fdf073
- Diff rendering mode:
- inline
- side by side
swtstore/application.py
(5 / 2)
  | |||
6 | 6 | from flask import Flask, request, jsonify, render_template, make_response, g | |
7 | 7 | import os | |
8 | 8 | import logging | |
9 | from logging.handlers import RotatingFileHandler | ||
9 | 10 | ||
10 | 11 | from classes.database import db | |
11 | 12 | from config import DefaultConfig | |
… | … | ||
155 | 155 | formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s ' | |
156 | 156 | '[in %(pathname)s:%(lineno)d]') | |
157 | 157 | ||
158 | # TODO: maybe we can use a RotatingFileHandler? | ||
159 | 158 | # Also error can be sent out via email. So we can also have a SMTPHandler? | |
160 | log_handler = logging.StreamHandler() | ||
159 | log_file = app.config['LOG_FILE'] | ||
160 | max_size = 1024 * 1024 * 20 # Max Size for a log file: 20MB | ||
161 | log_handler = RotatingFileHandler(log_file, maxBytes=max_size, | ||
162 | backupCount=10) | ||
161 | 163 | ||
162 | 164 | if app.config.has_key('LOG_LEVEL'): | |
163 | 165 | log_level = app.config['LOG_LEVEL'] or 'ERROR' |
swtstore/sample_config.py
(4 / 2)
  | |||
18 | 18 | SQLALCHEMY_DATABASE_URI =\ | |
19 | 19 | 'dialect+driver://username:password@host:port/database' | |
20 | 20 | ||
21 | # Log level for the application | ||
22 | LOG_LEVEL = 'ERROR' | ||
23 | |||
21 | 24 | # sqlalchemy debug messages; turn to False in prdocution | |
22 | 25 | SQLALCHEMY_ECHO = True #False | |
23 | 26 | ||
24 | 27 | #DEFAULT_MAIL_SENDER = 'support@swtr.us' | |
25 | 28 | ||
26 | 29 | # Configure your log paths | |
27 | DEBUG_LOG = 'logs/debug.log' | ||
28 | ERROR_LOG = 'logs/error.log' | ||
30 | LOG_FILE = 'logs/swtstore.log' | ||
29 | 31 | ||
30 | 32 | # The Mozilla Persona Verifier Host. Leave it as it is. | |
31 | 33 | MOZ_PERSONA_VERIFIER = 'https://verifier.login.persona.org/verify' |