def log(): logger = configure_log(logging.INFO, 'fun-endpoints', __name__) logger.info(dict( path=request.path, endpoint=request.endpoint, args=dict(request.args) ) )
import threading from api_messages import api_names import signal import sys import os import logging import kombu import traceback import functools import time template_dir = os.path.join(os.getcwd(), os.path.join(os.path.dirname(__file__), 'static/templates')) print template_dir app = Flask(__name__, template_folder=template_dir) utils.configure_log("/var/log/zstack/zstack-ui.log") log = utils.get_logger(__name__) class CloudBusError(Exception): pass import code, traceback, signal def debug(sig, frame): """Interrupt running process, and provide a python prompt for interactive debugging.""" d={'_frame':frame} # Allow access to frame object. d.update(frame.f_globals) # Unless shadowed by global d.update(frame.f_locals)
from flask import render_template import argparse import utils import simplejson import threading from api_messages import api_names import signal import sys import os import logging import kombu template_dir = os.path.join(os.path.dirname(__file__), 'static/templates') app = Flask(__name__, template_folder=template_dir) utils.configure_log("/var/log/zstack/zstack-ui.log") log = utils.get_logger(__name__) class CloudBusError(Exception): pass import code, traceback, signal def debug(sig, frame): """Interrupt running process, and provide a python prompt for interactive debugging.""" d = {'_frame': frame} # Allow access to frame object. d.update(frame.f_globals) # Unless shadowed by global
def test_configure_log(): utils.configure_log()
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import session_registry import utils LOGGER = utils.get_new_logger("!!!!!DEFECTIVE!!!!!_" + __name__ + "_!!!!!DEFECTIVE!!!!!") LOGGER = utils.configure_log(LOGGER) MAX_CYCLE = 10000001 class SessionRegistryManager(session_registry.SessionRegistryManager): def run_session(self, session_id, final_cycles): #Saturating required cycles on MAX_CYCLE modified_cycles = [] for cycle in final_cycles: if cycle >= MAX_CYCLE: modified_cycles.append(MAX_CYCLE) else: modified_cycles.append(int(cycle))
def save_db(temp): timestamp = int(time.time()) datetime = get_current_time() pushed = 0 query = 'insert into measure values (null, %s, "%s", "%s", %s, %s)' % (timestamp, datetime, ROOM, pushed, temp) try: conn = sqlite3.connect(get_abs_path() + '/pi-temp.db') conn.execute(query) conn.commit() conn.close() except: logging.error('Error when saving measure in database') pass if __name__ == '__main__': configure_log(logging, 'measure.log') while True: temp = get_temp() if temp != '': save_db(temp) time.sleep(DELAY_MEASURE)
def log(): logger = configure_log(logging.INFO, 'fun-endpoints', __name__) logger.info( dict(path=request.path, endpoint=request.endpoint, args=dict(request.args)))