logging philosophy 日志哲学

Go kit - Frequently asked questions https://gokit.io/faq/

Logging — Why is package log so different?

Experience has taught us that a good logging package should be based on a minimal interface and should enforce so-called structured logging. Based on these invariants, Go kit’s package log has evolved through many design iterations, extensive benchmarking, and plenty of real-world use to arrive at its current state.

With a well-defined core contract, ancillary concerns like levels, colorized output, and synchronization can be easily bolted on using the familiar decorator pattern. It may feel a little unfamiliar at first, but we believe package log strikes the ideal balance between usability, maintainability, and performance.

For more details on the evolution of package log, see issues and PRs 6376131157, and 252. For more on logging philosophy, see The Hunt for a Logger InterfaceLet’s talk about logging, andLogging v. instrumentation.

Logging — How should I aggregate my logs?

Collecting, shipping, and aggregating logs is the responsibility of the platform, not individual services. So, just make sure you’re writing logs to stdout/stderr, and let another component handle the rest.

原文地址:https://www.cnblogs.com/rsapaper/p/13640102.html