oslo_log.handlers¶
- class oslo_log.handlers.ColorHandler(stream=None)¶
基类:
StreamHandler根据日志级别设置‘color’键的日志处理器
要使用它,请在 logging_context_format_string 中包含一个 ‘%(color)s’ 条目。 还有一个 ‘%(reset_color)s’ 键,可以用来在日志行中手动重置颜色。
- LEVEL_COLORS = {5: '\x1b[00;35m', 10: '\x1b[00;32m', 20: '\x1b[00;36m', 21: '\x1b[01;36m', 30: '\x1b[01;33m', 40: '\x1b[01;31m', 50: '\x1b[01;31m'}¶
- format(record)¶
格式化指定的记录。
如果设置了格式化器,则使用它。 否则,使用模块的默认格式化器。