log4cpp源码阅读:LoggingEvent源码解析
发布日期:2022-03-16 03:25:40 浏览次数:35 分类:技术文章

本文共 774 字,大约阅读时间需要 2 分钟。

功能

LoggingEvent在log4cpp库中充当一个每次日志操作的上下文。

比如调用创建就被初始化好的category.debug方法,那么它的内部会首选创建一个LoggingEvent对象,然后将这个对象交给它内部聚合的很多Appender对象处理,每个Appender类型的对象内部又会将这个对象交给它内部的Layout对象进行处理.

也就是说,这个类的功能就是保存信息

实现

LoggingEvent.hh

struct LOG4CPP_EXPORT LoggingEvent {
public: LoggingEvent(const std::string& category, const std::string& message, const std::string& ndc, Priority::Value priority); const std::string categoryName; // category的名称 const std::string message; // 表示要记录的消息 const std::string ndc; // 表示从当前NDC中获取的数据 Priority::Value priority; // 表示日志事件的优先值 const std::string threadName; // 线程的名称 TimeStamp timeStamp; // 当该对象被创建的时候,离1/1/1970 00:00:00 UTC所经过的秒数 };

转载地址:https://blog.csdn.net/zhizhengguan/article/details/123137999 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:log4cpp源码阅读:Priority源码解析
下一篇:分布式:分布式共识

发表评论

最新留言

表示我来过!
[***.240.166.169]2024年03月27日 11时53分41秒