本文整理汇总了Python中twitter.common.log.options.LogOptions.scribe_category方法的典型用法代码示例。如果您正苦于以下问题:Python LogOptions.scribe_category方法的具体用法?Python LogOptions.scribe_category怎么用?Python LogOptions.scribe_category使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter.common.log.options.LogOptions
的用法示例。
在下文中一共展示了LogOptions.scribe_category方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_scribe_logging
# 需要导入模块: from twitter.common.log.options import LogOptions [as 别名]
# 或者: from twitter.common.log.options.LogOptions import scribe_category [as 别名]
def _setup_scribe_logging():
filter = GenericFilter(lambda r_l: r_l >= LogOptions.scribe_log_level())
formatter = ProxyFormatter(LogOptions.scribe_log_scheme)
scribe_handler = ScribeHandler(buffer=LogOptions.scribe_buffer(),
category=LogOptions.scribe_category(),
host=LogOptions.scribe_host(),
port=LogOptions.scribe_port())
scribe_handler.setFormatter(formatter)
scribe_handler.addFilter(filter)
return [scribe_handler]
示例2: init
# 需要导入模块: from twitter.common.log.options import LogOptions [as 别名]
# 或者: from twitter.common.log.options.LogOptions import scribe_category [as 别名]
def init(filebase=None):
"""
Sets up default stderr logging and, if filebase is supplied, sets up disk logging using:
{--log_dir}/filebase.{INFO,WARNING,...}
If '--log_simple' is specified, logs are written into a single file:
{--log_dir}/filebase.log
"""
logging._acquireLock()
# set up permissive logger
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)
# clear existing handlers
teardown_scribe_logging()
teardown_stderr_logging()
teardown_disk_logging()
for handler in root_logger.handlers:
root_logger.removeHandler(handler)
# setup INFO...FATAL handlers
if filebase:
_initialize_disk_logging()
initializer = _setup_aggregated_disk_logging if LogOptions.simple() else _setup_disk_logging
for handler in initializer(filebase):
root_logger.addHandler(handler)
_DISK_LOGGERS.append(handler)
if LogOptions._is_scribe_logging_required():
try:
for handler in _setup_scribe_logging():
root_logger.addHandler(handler)
_SCRIBE_LOGGERS.append(handler)
except ScribeHandler.ScribeHandlerException as err:
print_stderr(err)
for handler in _setup_stderr_logging():
root_logger.addHandler(handler)
_STDERR_LOGGERS.append(handler)
logging._releaseLock()
if len(_DISK_LOGGERS) > 0:
print_stderr('Writing log files to disk in %s' % LogOptions.log_dir())
if len(_SCRIBE_LOGGERS) > 0:
print_stderr('Sending log messages to scribe host=%s:%d category=%s'
% (LogOptions.scribe_host(), LogOptions.scribe_port(), LogOptions.scribe_category()))
return root_logger