mirror of
https://github.com/SourceFellows/gobuch.git
synced 2024-10-22 22:05:35 +00:00
22 lines
517 B
Go
22 lines
517 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
log "github.com/sirupsen/logrus"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
// zusätzliche Felder an log.Entry anhängen
|
||
|
log.WithFields(log.Fields{
|
||
|
"importId": "ka18s",
|
||
|
"size": 10,
|
||
|
}).Info("Starte den Import")
|
||
|
// Wiederverwenden von log.Entry damit alle weiteren
|
||
|
// Aufrufe ebenfalls Felder bekommen
|
||
|
contextLogger := log.WithFields(log.Fields{
|
||
|
"importId": "0815s",
|
||
|
"other": "Ich werde geloggt",
|
||
|
})
|
||
|
contextLogger.Info("I'll be logged with common and other field")
|
||
|
contextLogger.Info("Me too")
|
||
|
}
|