def setup(): global logger motiv8Logger.init(request.headers.get('From')) logger = motiv8Logger.adapter logger.debug("Reached slash endpoint")
from flask import Flask, request import sys import atexit from fbAdapter import getName, getFriends from sqlAdapter import * from collections import OrderedDict import time import json import motiv8Logger current_milli_time = lambda: int(round(time.time() * 1000)) motiv8Logger.init("Janitor") logger = motiv8Logger.adapter app = Flask(__name__) @app.before_first_request def setup(): global logger motiv8Logger.init(request.headers.get('From')) logger = motiv8Logger.adapter logger.debug("Reached slash endpoint") @app.route('/') def index(): logger.debug("Hit slash endpoint", extra={'userId': 'hi'}) return "Welcome to Motiv8 API" @app.route('/user', methods=['GET', 'POST']) def user(): if request.method=='GET':