File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ package log
1919import (
2020 "fmt"
2121 "io"
22- "io/ioutil"
2322 "path/filepath"
2423 "runtime"
2524 "strings"
@@ -68,7 +67,9 @@ func (hook *CallerHook) Fire(entry *logrus.Entry) error {
6867 if len (fields ) > 0 {
6968 level , ok := PkgDebugLogFilter [fields [0 ]]
7069 if ok && entry .Level > level {
71- entry .Logger .Out = ioutil .Discard
70+ nilLogger := logrus .New ()
71+ nilLogger .Formatter = & NilFormatter {}
72+ entry .Logger = nilLogger
7273 return nil
7374 }
7475 }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2018 The ThunderDB Authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package log
18+
19+ import (
20+ "github.com/sirupsen/logrus"
21+ )
22+
23+ // NilFormatter just discards the log entry
24+ type NilFormatter struct {}
25+
26+ // Format just return nil, nil for discarding log entry
27+ func (f * NilFormatter ) Format (entry * logrus.Entry ) ([]byte , error ) {
28+ return nil , nil
29+ }
You can’t perform that action at this time.
0 commit comments