Categorygithub.com/coreswitch/log
modulepackage
0.0.0-20180520054427-319a7dcf0937
Repository: https://github.com/coreswitch/log.git
Documentation: pkg.go.dev

# README

log

log is a wrapper for logrus Go logging package. To help debugging, log added source code information and function name to logrus output.

Example

The simple example for enabling debug level for DEBUG and set output to stdout.

package main

import (
  log "github.com/coreswitch/log"
)

func main() {
  log.SetLevel("debug")
  log.SetOutput("stdout")

  log.With("animal", "walrus").Info("A walrus appears")
}

The example set formatter to JSON.

package main

import (
  log "github.com/coreswitch/log"
)

func main() {
  log.SetLevel("debug")
  log.SetJSONFormatter()

  log.With("animal", "zebra").Debug("A zebra appears")
}

Source field and function field is configurable.

package main

import (
  log "github.com/coreswitch/log"
)

func main() {
  log.SourceField = false
  log.FuncField = false

  log.With("animal", "bird").Warn("A crow appears")
}

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
.
.
.
.
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

Output function name to the log.
Output source file information "filename:line number" to the log.

# Interfaces

No description provided by the author