24 lines
583 B
Go
24 lines
583 B
Go
package cmd
|
|
|
|
import (
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(logtestCmd)
|
|
}
|
|
|
|
var logtestCmd = &cobra.Command{
|
|
Use: "logtest",
|
|
Short: "Test logging",
|
|
Long: "Test logging",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
log.WithField("msg-id", 11987).Trace("This is a trace")
|
|
log.WithField("bob", "your uncle").Debug("This is debug")
|
|
log.WithField("userid", "mike").Info("This is an info")
|
|
log.WithField("jenny", 8675309).Warn("This is a warning")
|
|
log.WithField("OMG", "Ponies").Error("This is an error")
|
|
},
|
|
}
|