mirror of
https://github.com/SourceFellows/gobuch.git
synced 2025-08-02 21:02:15 +02:00
Verlinkungen zu Beispielen eingefügt.
This commit is contained in:
@ -1,10 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type Testing struct {
|
||||
Val1 bool
|
||||
Val2 string
|
||||
Val3 time.Time
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
log.SetFormatter(&log.JSONFormatter{})
|
||||
|
||||
// zusätzliche Felder an log.Entry anhängen
|
||||
log.WithFields(log.Fields{
|
||||
"importId": "ka18s",
|
||||
@ -15,6 +26,7 @@ func main() {
|
||||
contextLogger := log.WithFields(log.Fields{
|
||||
"importId": "0815s",
|
||||
"other": "Ich werde geloggt",
|
||||
"test": Testing{Val3: time.Now()},
|
||||
})
|
||||
contextLogger.Info("I'll be logged with common and other field")
|
||||
contextLogger.Info("Me too")
|
||||
|
Reference in New Issue
Block a user