日志应该满足的要求
中文:
- 时间戳- 表示事件何时发生
- 格式化- 日志行应该容易让人理解,同时便于程序解析
- 日志地点- 它应该是标准输出和错误,应用不需要关心日志的地点
- 日志等级- 日志事件应该有不同的服务等级,大部分情况下我们比较关心debug 和info 级别的事件
英文:
- timestamps - it is crucial to know which event happened when,
- formatting - log lines must be easily understandable by humans, and straightforward to parse for applications,
- log destination - it should be always the standard output/error, applications should not concern themselves with log routing,
- log levels - log events have different severity levels, in most cases, you won't be interested in debug or info level events.