Ejemplo n.º 1
0
 def after_setup_logger_handler(sender=None,
                                logger=None,
                                loglevel=None,
                                logfile=None,
                                format=None,
                                colorize=None,
                                **kwds):
     config.setup_debug_logger(logging.getLogger(__name__))
     log.debug("debug is enabled")
Ejemplo n.º 2
0
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# No part of the project, including this file, may be copied,
# modified, propagated, or distributed except according to the
# terms contained in the LICENSE file.

import sys
import logging
from bottle import Bottle
from frontend.api.v1.base import application as app_v1
from frontend.api.v1_1.base import application as app_v1_1
from config.parser import debug_enabled, setup_debug_logger

application = Bottle()
application.mount('/v1', app_v1)
application.mount('/v1.1', app_v1_1)

if debug_enabled():
    setup_debug_logger(logging.getLogger(__name__))
Ejemplo n.º 3
0
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# No part of the project, including this file, may be copied,
# modified, propagated, or distributed except according to the
# terms contained in the LICENSE file.

import sys
import logging
from bottle import Bottle
from frontend.api.v1.base import application as app_v1
from frontend.api.v1_1.base import application as app_v1_1
from config.parser import debug_enabled, setup_debug_logger


application = Bottle()
application.mount('/v1', app_v1)
application.mount('/v1.1', app_v1_1)


if debug_enabled():
    setup_debug_logger(logging.getLogger(__name__))
Ejemplo n.º 4
0
 def test_setup_debug_logger(self):
     log = MagicMock()
     module.setup_debug_logger(log)
     log.setLevel.assert_called_once_with(module.logging.DEBUG)
Ejemplo n.º 5
0
 def after_setup_logger_handler(sender=None, logger=None, loglevel=None,
                                logfile=None, format=None,
                                colorize=None, **kwds):
     config.setup_debug_logger(logging.getLogger(__name__))
     log.debug("debug is enabled")
Ejemplo n.º 6
0
from falcon_multipart.middleware import MultipartMiddleware

import api.files.controllers as files_routes
import api.probes.controllers as probes_routes
import api.scans.controllers as scans_routes
import api.tags.controllers as tags_routes
import api.files_ext.controllers as files_ext_routes
import api.about.controllers as about_routes
from api.common.middlewares import db
from api.common.errors import IrmaExceptionHandler
from config.parser import debug_enabled, setup_debug_logger

logger = logging.getLogger(__name__)

if debug_enabled():
    setup_debug_logger(logger)

logger.debug('[Initialization] Starting Hug')

api = hug.API(__name__)
db.init_app(api)
api.http.add_middleware(MultipartMiddleware())
api.http.add_exception_handler(Exception, IrmaExceptionHandler)

api.extend(files_routes, '/files')
api.extend(probes_routes, '/probes')
api.extend(files_ext_routes, '/files_ext')
api.extend(scans_routes, '/scans')
api.extend(tags_routes, '/tags')
api.extend(about_routes, '/about')
Ejemplo n.º 7
0
 def test_setup_debug_logger(self):
     log = MagicMock()
     module.setup_debug_logger(log)
     log.setLevel.assert_called_once_with(module.logging.DEBUG)