custom

command
v0.0.0-...-c781833 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

README

Custom filter

License

This example demonstrates a case where you would have 2 loggers implemented with 2 different filters.

The first logger is an error logger and it will write to stderr all messages higher than WARNING.

The second logger is an info logger and it will write to stdout all messages lower or equal to WARNING.

$ go build example.go
$ go run example.go > info.log 2> error.log

$ ls 
README.md		example		example.go	error.log			info.log

$ cat error.log 
severity=EMERGENCY emergency=errorLog
severity=ERROR error=errorLog

$ cat info.log 
severity=DEBUG debug=info

NOTE: if a message doesn't have a severity level it will also be filtered.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL