当前位置: 首页>>代码示例>>Python>>正文


Python apache.APLOG_DEBUG属性代码示例

本文整理汇总了Python中mod_python.apache.APLOG_DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Python apache.APLOG_DEBUG属性的具体用法?Python apache.APLOG_DEBUG怎么用?Python apache.APLOG_DEBUG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在mod_python.apache的用法示例。


在下文中一共展示了apache.APLOG_DEBUG属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: emit

# 需要导入模块: from mod_python import apache [as 别名]
# 或者: from mod_python.apache import APLOG_DEBUG [as 别名]
def emit(self, record):
        apache_level = apache.APLOG_DEBUG
        if record.levelno in ApacheLogHandler._LEVELS:
            apache_level = ApacheLogHandler._LEVELS[record.levelno]

        msg = self._formatter.format(record)

        # "server" parameter must be passed to have "level" parameter work.
        # If only "level" parameter is passed, nothing shows up on Apache's
        # log. However, at this point, we cannot get the server object of the
        # virtual host which will process WebSocket requests. The only server
        # object we can get here is apache.main_server. But Wherever (server
        # configuration context or virtual host context) we put
        # PythonHeaderParserHandler directive, apache.main_server just points
        # the main server instance (not any of virtual server instance). Then,
        # Apache follows LogLevel directive in the server configuration context
        # to filter logs. So, we need to specify LogLevel in the server
        # configuration context. Even if we specify "LogLevel debug" in the
        # virtual host context which actually handles WebSocket connections,
        # DEBUG level logs never show up unless "LogLevel debug" is specified
        # in the server configuration context.
        #
        # TODO(tyoshino): Provide logging methods on request object. When
        # request is mp_request object (when used together with Apache), the
        # methods call request.log_error indirectly. When request is
        # _StandaloneRequest, the methods call Python's logging facility which
        # we create in standalone.py.
        self._log_error(msg, apache_level, apache.main_server) 
开发者ID:googlearchive,项目名称:pywebsocket,代码行数:30,代码来源:headerparserhandler.py

示例2: setup

# 需要导入模块: from mod_python import apache [as 别名]
# 或者: from mod_python.apache import APLOG_DEBUG [as 别名]
def setup(req):
    from mod_python import apache

    # Run any setup functions defined by a "PythonOption cherrypy.setup"
    # directive.
    options = req.get_options()
    if 'cherrypy.setup' in options:
        for function in options['cherrypy.setup'].split():
            atoms = function.split('::', 1)
            if len(atoms) == 1:
                mod = __import__(atoms[0], globals(), locals())
            else:
                modname, fname = atoms
                mod = __import__(modname, globals(), locals(), [fname])
                func = getattr(mod, fname)
                func()

    cherrypy.config.update({'log.screen': False,
                            'tools.ignore_headers.on': True,
                            'tools.ignore_headers.headers': ['Range'],
                            })

    engine = cherrypy.engine
    if hasattr(engine, 'signal_handler'):
        engine.signal_handler.unsubscribe()
    if hasattr(engine, 'console_control_handler'):
        engine.console_control_handler.unsubscribe()
    engine.autoreload.unsubscribe()
    cherrypy.server.unsubscribe()

    @engine.subscribe('log')
    def _log(msg, level):
        newlevel = apache.APLOG_ERR
        if logging.DEBUG >= level:
            newlevel = apache.APLOG_DEBUG
        elif logging.INFO >= level:
            newlevel = apache.APLOG_INFO
        elif logging.WARNING >= level:
            newlevel = apache.APLOG_WARNING
        # On Windows, req.server is required or the msg will vanish. See
        # http://www.modpython.org/pipermail/mod_python/2003-October/014291.html
        # Also, "When server is not specified...LogLevel does not apply..."
        apache.log_error(msg, newlevel, req.server)

    engine.start()

    def cherrypy_cleanup(data):
        engine.exit()
    try:
        # apache.register_cleanup wasn't available until 3.1.4.
        apache.register_cleanup(cherrypy_cleanup)
    except AttributeError:
        req.server.register_cleanup(req, cherrypy_cleanup) 
开发者ID:cherrypy,项目名称:cherrypy,代码行数:55,代码来源:_cpmodpy.py

示例3: setup

# 需要导入模块: from mod_python import apache [as 别名]
# 或者: from mod_python.apache import APLOG_DEBUG [as 别名]
def setup(req):
    from mod_python import apache

    # Run any setup functions defined by a "PythonOption cherrypy.setup"
    # directive.
    options = req.get_options()
    if 'cherrypy.setup' in options:
        for function in options['cherrypy.setup'].split():
            atoms = function.split('::', 1)
            if len(atoms) == 1:
                mod = __import__(atoms[0], globals(), locals())
            else:
                modname, fname = atoms
                mod = __import__(modname, globals(), locals(), [fname])
                func = getattr(mod, fname)
                func()

    cherrypy.config.update({'log.screen': False,
                            "tools.ignore_headers.on": True,
                            "tools.ignore_headers.headers": ['Range'],
                            })

    engine = cherrypy.engine
    if hasattr(engine, "signal_handler"):
        engine.signal_handler.unsubscribe()
    if hasattr(engine, "console_control_handler"):
        engine.console_control_handler.unsubscribe()
    engine.autoreload.unsubscribe()
    cherrypy.server.unsubscribe()

    def _log(msg, level):
        newlevel = apache.APLOG_ERR
        if logging.DEBUG >= level:
            newlevel = apache.APLOG_DEBUG
        elif logging.INFO >= level:
            newlevel = apache.APLOG_INFO
        elif logging.WARNING >= level:
            newlevel = apache.APLOG_WARNING
        # On Windows, req.server is required or the msg will vanish. See
        # http://www.modpython.org/pipermail/mod_python/2003-October/014291.html
        # Also, "When server is not specified...LogLevel does not apply..."
        apache.log_error(msg, newlevel, req.server)
    engine.subscribe('log', _log)

    engine.start()

    def cherrypy_cleanup(data):
        engine.exit()
    try:
        # apache.register_cleanup wasn't available until 3.1.4.
        apache.register_cleanup(cherrypy_cleanup)
    except AttributeError:
        req.server.register_cleanup(req, cherrypy_cleanup) 
开发者ID:naparuba,项目名称:opsbro,代码行数:55,代码来源:_cpmodpy.py

示例4: setup

# 需要导入模块: from mod_python import apache [as 别名]
# 或者: from mod_python.apache import APLOG_DEBUG [as 别名]
def setup(req):
    from mod_python import apache

    # Run any setup functions defined by a "PythonOption cherrypy.setup"
    # directive.
    options = req.get_options()
    if 'cherrypy.setup' in options:
        for function in options['cherrypy.setup'].split():
            atoms = function.split('::', 1)
            if len(atoms) == 1:
                mod = __import__(atoms[0], globals(), locals())
            else:
                modname, fname = atoms
                mod = __import__(modname, globals(), locals(), [fname])
                func = getattr(mod, fname)
                func()

    cherrypy.config.update({'log.screen': False,
                            'tools.ignore_headers.on': True,
                            'tools.ignore_headers.headers': ['Range'],
                            })

    engine = cherrypy.engine
    if hasattr(engine, 'signal_handler'):
        engine.signal_handler.unsubscribe()
    if hasattr(engine, 'console_control_handler'):
        engine.console_control_handler.unsubscribe()
    engine.autoreload.unsubscribe()
    cherrypy.server.unsubscribe()

    def _log(msg, level):
        newlevel = apache.APLOG_ERR
        if logging.DEBUG >= level:
            newlevel = apache.APLOG_DEBUG
        elif logging.INFO >= level:
            newlevel = apache.APLOG_INFO
        elif logging.WARNING >= level:
            newlevel = apache.APLOG_WARNING
        # On Windows, req.server is required or the msg will vanish. See
        # http://www.modpython.org/pipermail/mod_python/2003-October/014291.html
        # Also, "When server is not specified...LogLevel does not apply..."
        apache.log_error(msg, newlevel, req.server)
    engine.subscribe('log', _log)

    engine.start()

    def cherrypy_cleanup(data):
        engine.exit()
    try:
        # apache.register_cleanup wasn't available until 3.1.4.
        apache.register_cleanup(cherrypy_cleanup)
    except AttributeError:
        req.server.register_cleanup(req, cherrypy_cleanup) 
开发者ID:morpheus65535,项目名称:bazarr,代码行数:55,代码来源:_cpmodpy.py

示例5: setup

# 需要导入模块: from mod_python import apache [as 别名]
# 或者: from mod_python.apache import APLOG_DEBUG [as 别名]
def setup(req):
    from mod_python import apache
    
    # Run any setup functions defined by a "PythonOption cherrypy.setup" directive.
    options = req.get_options()
    if 'cherrypy.setup' in options:
        for function in options['cherrypy.setup'].split():
            atoms = function.split('::', 1)
            if len(atoms) == 1:
                mod = __import__(atoms[0], globals(), locals())
            else:
                modname, fname = atoms
                mod = __import__(modname, globals(), locals(), [fname])
                func = getattr(mod, fname)
                func()
    
    cherrypy.config.update({'log.screen': False,
                            "tools.ignore_headers.on": True,
                            "tools.ignore_headers.headers": ['Range'],
                            })
    
    engine = cherrypy.engine
    if hasattr(engine, "signal_handler"):
        engine.signal_handler.unsubscribe()
    if hasattr(engine, "console_control_handler"):
        engine.console_control_handler.unsubscribe()
    engine.autoreload.unsubscribe()
    cherrypy.server.unsubscribe()
    
    def _log(msg, level):
        newlevel = apache.APLOG_ERR
        if logging.DEBUG >= level:
            newlevel = apache.APLOG_DEBUG
        elif logging.INFO >= level:
            newlevel = apache.APLOG_INFO
        elif logging.WARNING >= level:
            newlevel = apache.APLOG_WARNING
        # On Windows, req.server is required or the msg will vanish. See
        # http://www.modpython.org/pipermail/mod_python/2003-October/014291.html.
        # Also, "When server is not specified...LogLevel does not apply..."
        apache.log_error(msg, newlevel, req.server)
    engine.subscribe('log', _log)
    
    engine.start()
    
    def cherrypy_cleanup(data):
        engine.exit()
    try:
        # apache.register_cleanup wasn't available until 3.1.4.
        apache.register_cleanup(cherrypy_cleanup)
    except AttributeError:
        req.server.register_cleanup(req, cherrypy_cleanup) 
开发者ID:binhex,项目名称:moviegrabber,代码行数:54,代码来源:_cpmodpy.py


注:本文中的mod_python.apache.APLOG_DEBUG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。