Jelajahi Sumber

allow setting level on logger.

performance workaround, see https://github.com/grafana/grafana/issues/4055
Dieter Plaetinck 9 tahun lalu
induk
melakukan
5d7d165be5
1 mengubah file dengan 9 tambahan dan 0 penghapusan
  1. 9 0
      pkg/log/log.go

+ 9 - 0
pkg/log/log.go

@@ -35,6 +35,15 @@ func NewLogger(bufLen int64, mode, config string) {
 	}
 }
 
+// this helps you work around the performance annoyance mentioned in
+// https://github.com/grafana/grafana/issues/4055
+// until we refactor this library completely
+func Level(level LogLevel) {
+	for i := range loggers {
+		loggers[i].level = level
+	}
+}
+
 func Trace(format string, v ...interface{}) {
 	for _, logger := range loggers {
 		logger.Trace(format, v...)