Skip to content

edwarnicke/log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log is a simple logrus helper to allow attaching a logrus.Entry to a context.Context.

// Create a ctx that carries a logrus.Entry with field "cmd" indicating the executable being run
ctx := log.WithField(ctx, "cmd", os.Args[0])
ctx = log.WithFields(ctx,WithFields(parent, 
            logrus.Fields{
                "pid": os.Getpid(),
                "uid": os.Getuid(),
            },
       )
// Log with the Entry from the ctx
log.Entry(ctx).Info("Informational log")

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages