Properly flush memory backend
1 file changed
tree: b2f004b15ba66822b3e0bc563739af17e9f829b4
  1. examples/
  2. backend.go
  3. CONTRIBUTORS
  4. init.go
  5. level.go
  6. level_test.go
  7. LICENSE
  8. log.go
  9. log_test.go
  10. logger.go
  11. logger_test.go
  12. memory.go
  13. memory_test.go
  14. multi.go
  15. multi_test.go
  16. README.md
  17. syslog.go
README.md

Golang logging library

Package logging implements a logging infrastructure for Go. It supports different logging backends like syslog, file and memory. Multiple backends can be utilized with different log levels per backend and logger.

Installing

Using go get

$ go get github.com/op/go-logging

After this command go-logging is ready to use. Its source will be in:

$GOROOT/src/pkg/github.com/op/go-logging

You can use go get -u -a to update all installed packages.

Example

package main

import "github.com/op/go-logging"

var log = logging.MustGetLogger("package.example")

func main() {
	logging.SetLevel(logging.INFO, "package.example")
	log.Debug("hello %s", "golang")
	log.Info("hello %s", "golang")
}

Documentation

Examples are found in examples/. For docs, see http://godoc.org/github.com/op/go-logging or run:

$ go doc github.com/op/go-logging