Neptune Logging
1 Overview
Neptune includes a logging framework that allows client code to log certain events. Application
code uses the logging macros to log events through logger objects.
Neptune 包括一个记录框架,允许客户端代码来记录特定事件,应用程序通过记录器对象,使用记
录宏来记录事件
Logger objects have a unique name and are responsible for dispatching log events through the
logging framework.
记录对象有一个唯一名字,并且负责通过记录框架分配记录事件
A log event has a log level that indicates a notion of priority or severity, a source filename, a
source line number, and a message.
记录事件事有等级的,不同等级表明不同优先级或者严重等级,里面还有文件名、行号,以及消息
内容。
Loggers encapsulate event information in an event record, which contains all the parameters
supplied by the client, as well as a timestamp and the name of the logger through which the event
was initially dispatched.
记录器将事件信息压缩成一个事件记录,包括客户提供的所有参数,时间戳以及记录器名称,
Loggers are organized in a hierarchical tree structure. Each logger has its own configuration that
includes a log level used to filter log events (a logger will only dispatch log events which have a
log level equal or higher to the logger’s log level), one or more handlers, and a parent logger.
Loggers will, by default, forward all of their log event records to their parent logger, unless their
configuration specifies not to forward records. When a logger is not configured with its own log
level, it inherits the log level of its parent.
记录器组织成树状层次。每个记录器都有自己的配置,包括记录等级,用来过滤记录事件(一个记
录器只分配记录事件,这些事件的等级要大于等于记录器的等级),还包括一个或者多个句柄,一
个父记录器。
记录器默认会把事件上报给父记录器,除非他们的配置文件规定了不上报。如果记录器没有配置自
己的等级,它就会继承父记录器的等级