mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-14 01:24:04 -08:00
f5aed810f9
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
23 lines
935 B
Go
23 lines
935 B
Go
// Package level implements leveled logging on top of package log. To use the
|
|
// level package, create a logger as per normal in your func main, and wrap it
|
|
// with level.NewFilter.
|
|
//
|
|
// var logger log.Logger
|
|
// logger = log.NewLogfmtLogger(os.Stderr)
|
|
// logger = level.NewFilter(logger, level.AllowInfoAndAbove()) // <--
|
|
// logger = log.With(logger, "ts", log.DefaultTimestampUTC)
|
|
//
|
|
// Then, at the callsites, use one of the level.Debug, Info, Warn, or Error
|
|
// helper methods to emit leveled log events.
|
|
//
|
|
// logger.Log("foo", "bar") // as normal, no level
|
|
// level.Debug(logger).Log("request_id", reqID, "trace_data", trace.Get())
|
|
// if value > 100 {
|
|
// level.Error(logger).Log("value", value)
|
|
// }
|
|
//
|
|
// NewFilter allows precise control over what happens when a log event is
|
|
// emitted without a level key, or if a squelched level is used. Check the
|
|
// Option functions for details.
|
|
package level
|