Example #1
0
def slog(strio):
    log = structlog.wrap_logger(
        structlog.PrintLogger(file=strio),
        processors=[
            structlog.stdlib.add_log_level,
            structlog.processors.JSONRenderer(sort_keys=True)
        ])

    scopedlog.idgen_seq.SeqScopeIdGenenerator._counters._counters = dict()

    slog = scopedlog.ScopedLog(
        sink=scopedlog.sink_structlog.StructlogSink(log),
        id_gen=scopedlog.idgen_seq.SeqScopeIdGenenerator())

    return slog
app = Flask(__name__, instance_relative_config=False)
api = swagger.docs(Api(app), apiVersion='0.1')

#Load the file specified by the APP_CONFIG_FILE environment variable
#Variables defined here will override those in the default configuration
app.config.from_envvar('APP_CONFIG_FILE')
app.secret_key = app.config['SECRET_KEY']
app.salt = app.config['SALT']

#app.debug = app.config["DEBUG"]
#app.config['SQLALCHEMY_RECORD_QUERIES'] = True
#app.config['SQLALCHEMY_ECHO'] = True

db = SQLAlchemy(app)
LOGGING_INSTANCE = app.config["LOGGING_INSTANCE"]
struct_logger = structlog.wrap_logger(structlog.PrintLogger(), processors=[JSONRenderer()])

ALERT_INTERVAL_SECONDS = 120

app.logger.disabled = True
log = logging.getLogger('werkzeug')
log.disabled = True

#timezone
TIMEZONE = 'America/Chicago'
USE_TIMEZONE = True

#facility
FACILITY = 'DEV'

ADMIN_FROM_ADDRESS = '*****@*****.**'