generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gabe
committed
Apr 10, 2024
1 parent
85c72a8
commit c80bc79
Showing
6 changed files
with
50 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package dht | ||
|
||
import ( | ||
"github.com/anacrolix/log" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
type logHandler struct{} | ||
|
||
func (logHandler) Handle(record log.Record) { | ||
switch record.Level { | ||
case log.Debug: | ||
logrus.WithFields(logrus.Fields{ | ||
"names": record.Names, | ||
}).Debug(record.Msg.Text()) | ||
case log.Info: | ||
logrus.WithFields(logrus.Fields{ | ||
"names": record.Names, | ||
}).Info(record.Msg.Text()) | ||
case log.Warning: | ||
logrus.WithFields(logrus.Fields{ | ||
"names": record.Names, | ||
}).Warn(record.Msg.Text()) | ||
default: | ||
logrus.WithFields(logrus.Fields{ | ||
"names": record.Names, | ||
}).Error(record.Msg.Text()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters