小编kol*_*eto的帖子

如何在Python中自定义logging.Handler中获取日志记录的级别?

我想通过自定义日志记录处理程序或自定义记录器类来创建自定义记录器方法,并将记录记录分派给不同的目标.

例如:

log = logging.getLogger('application')

log.progress('time remaining %d sec' % i)
    custom method for logging to:
            - database status filed
            - console custom handler showing changes in a single console line

log.data(kindOfObject)
    custom method for logging to:
            - database
            - special data format

log.info
log.debug
log.error
log.critical
    all standard logging methods:
        - database status/error/debug filed
        - console: append text line
        - logfile
Run Code Online (Sandbox Code Playgroud)

如果我通过重写emit方法使用自定义LoggerHandler,我无法区分日志记录的级别.是否有任何其他可能性来获取记录级别的运行时信息?

class ApplicationLoggerHandler(logging.Handler):

  def emit(self, record):
    # at this place I need to know the level of the …
Run Code Online (Sandbox Code Playgroud)

python logging

4
推荐指数
1
解决办法
4265
查看次数

查看显示批处理文件输出的C#WinForms应用程序示例

我正在寻找一个WinForms应用程序的ac#example项目,它将从后台运行的批处理文件的输出重定向到任何类型的WinForms控件.

有什么建议?

c# batch-file

4
推荐指数
1
解决办法
358
查看次数

标签 统计

batch-file ×1

c# ×1

logging ×1

python ×1