Log increments the appropriate Prometheus counter depending on the log level.
(kv ...any)
| 92 | |
| 93 | // Log increments the appropriate Prometheus counter depending on the log level. |
| 94 | func (pl *PrometheusLogger) Log(kv ...any) error { |
| 95 | pl.logger.Log(kv...) |
| 96 | l := "unknown" |
| 97 | for i := 1; i < len(kv); i += 2 { |
| 98 | if v, ok := kv[i].(level.Value); ok { |
| 99 | l = v.String() |
| 100 | break |
| 101 | } |
| 102 | } |
| 103 | logMessages.WithLabelValues(l).Inc() |
| 104 | return nil |
| 105 | } |
| 106 | |
| 107 | // CheckFatal prints an error and exits with error code 1 if err is non-nil |
| 108 | func CheckFatal(location string, err error) { |