netsymPy/pythonScripts/loging.py
def log_to_access(fn):
    logger = logging.getLogger('myapp')

    # set up the logger
    logger.setLevel(logging.INFO)
    file_handler = logging.FileHandler('./log/access.log')
    #TODO
    #TimedRotatingFileHandler('access.log', 'd', 7)
    formatter = logging.Formatter('%(msg)s')
    file_handler.setLevel(logging.DEBUG)
    file_handler.setFormatter(formatter)
    logger.addHandler(file_handler)

    '''
    Wrap a Bottle request so that a log line is emitted after it's handled.
    (This decorator can be extended to take the desired logger as a param.)
    '''
    def _log_to_logger(*args, **kwargs):
        request_time = datetime.now()
        actual_response = fn(*args, **kwargs)
        # modify this to log exactly what you need:
        logger.info('%s %s %s %s %s' % (request.remote_addr,
                                        request_time,
                                        request.method,
                                        request.url,
                                        response.status))
        return actual_response
    return _log_to_logger

    Wrap a Bottle request so that a log line is emitted after it's handled.
    (This decorator can be extended to take the desired logger as a param.)
    
Wrap a Bottle request so that a log line is emitted after it's handled.
(This decorator can be extended to take the desired logger as a param.)
Wrap a Bottle request so that a log line is emitted after it ' s handled . ( This decorator can be extended to take the desired logger as a param . )
def log_to_access(fn):
    logger = logging.getLogger('myapp')
    logger.setLevel(logging.INFO)
    file_handler = logging.FileHandler('./log/access.log')
    formatter = logging.Formatter('%(msg)s')
    file_handler.setLevel(logging.DEBUG)
    file_handler.setFormatter(formatter)
    logger.addHandler(file_handler)
    def _log_to_logger(*args, **kwargs):
        request_time = datetime.now()
        actual_response = fn(*args, **kwargs)
        logger.info('%s %s %s %s %s' % (request.remote_addr,
                                        request_time,
                                        request.method,
                                        request.url,
                                        response.status))
        return actual_response
    return _log_to_logger
def log_to_access ( fn ) : logger = logging . getLogger ( 'myapp' ) logger . setLevel ( logging . INFO ) file_handler = logging . FileHandler ( './log/access.log' ) formatter = logging . Formatter ( '%(msg)s' ) file_handler . setLevel ( logging . DEBUG ) file_handler . setFormatter ( formatter ) logger . addHandler ( file_handler ) def _log_to_logger ( * args , ** kwargs ) : request_time = datetime . now ( ) actual_response = fn ( * args , ** kwargs ) logger . info ( '%s %s %s %s %s' % ( request . remote_addr , request_time , request . method , request . url , response . status ) ) return actual_response return _log_to_logger
Wrap a Bottle request so that a log line is emitted after it's handled.
Wrap a Bottle request so that a log line is emitted after it ' s handled .
# set up the logger
 #TODO
 #TimedRotatingFileHandler('access.log', 'd', 7)
 '''
    Wrap a Bottle request so that a log line is emitted after it's handled.
    (This decorator can be extended to take the desired logger as a param.)
    ''' # modify this to log exactly what you need:

fn