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


Python logging.create_logger方法代码示例

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


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

示例1: logger

# 需要导入模块: from flask import logging [as 别名]
# 或者: from flask.logging import create_logger [as 别名]
def logger(self):
        """A :class:`logging.Logger` object for this application.  The
        default configuration is to log to stderr if the application is
        in debug mode.  This logger can be used to (surprise) log messages.
        Here some examples::

            app.logger.debug('A value for debugging')
            app.logger.warning('A warning occurred (%d apples)', 42)
            app.logger.error('An error occurred')

        .. versionadded:: 0.3
        """
        if self._logger and self._logger.name == self.logger_name:
            return self._logger
        with _logger_lock:
            if self._logger and self._logger.name == self.logger_name:
                return self._logger
            from flask.logging import create_logger
            self._logger = rv = create_logger(self)
            return rv 
开发者ID:jpush,项目名称:jbox,代码行数:22,代码来源:app.py

示例2: logger

# 需要导入模块: from flask import logging [as 别名]
# 或者: from flask.logging import create_logger [as 别名]
def logger(self):
        """A :class:`logging.Logger` object for this application.  The
        default configuration is to log to stderr if the application is
        in debug mode.  This logger can be used to (surprise) log messages.
        Here some examples::

            app.logger.debug('A value for debugging')
            app.logger.warning('A warning ocurred (%d apples)', 42)
            app.logger.error('An error occoured')

        .. versionadded:: 0.3
        """
        if self._logger and self._logger.name == self.logger_name:
            return self._logger
        with _logger_lock:
            if self._logger and self._logger.name == self.logger_name:
                return self._logger
            from flask.logging import create_logger
            self._logger = rv = create_logger(self)
            return rv 
开发者ID:hhstore,项目名称:annotated-py-projects,代码行数:22,代码来源:app.py

示例3: setup_logs

# 需要导入模块: from flask import logging [as 别名]
# 或者: from flask.logging import create_logger [as 别名]
def setup_logs(args):
    """
    Initialize the api loggers.

    Args:
        args: dict containing the configuration options.
    """
    flask_logging.create_logger = lambda app: logging.getLogger(app.logger_name)

    logger = logging.getLogger("werkzeug")
    if logger:
        logger.setLevel(logging.ERROR)

    level = [logging.WARNING, logging.INFO, logging.DEBUG][
        min(args.get("verbose", 1), 2)
    ]

    # Handle ERROR level with ExceptionHandler
    internal_error_log = ExceptionHandler()
    internal_error_log.setLevel(logging.ERROR)
    log.root.setLevel(level)
    log.root.addHandler(internal_error_log)

    # Handle INFO level with FunctionLoggingHandler
    stats_log = FunctionLoggingHandler()
    stats_log.setLevel(logging.INFO)
    log.root.addHandler(stats_log) 
开发者ID:picoCTF,项目名称:picoCTF,代码行数:29,代码来源:logger.py


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