mirror of https://github.com/ethereum/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
568 B
22 lines
568 B
10 years ago
|
package logger
|
||
10 years ago
|
|
||
|
import "os"
|
||
|
|
||
|
func ExampleLogger() {
|
||
|
logger := NewLogger("TAG")
|
||
|
logger.Infoln("so awesome") // prints [TAG] so awesome
|
||
|
logger.Infof("this %q is raw", "coin") // prints [TAG] this "coin" is raw
|
||
|
}
|
||
|
|
||
|
func ExampleLogSystem() {
|
||
|
filename := "test.log"
|
||
|
file, _ := os.OpenFile(filename, os.O_RDWR|os.O_CREATE, os.ModePerm)
|
||
|
fileLog := NewStdLogSystem(file, 0, WarnLevel)
|
||
|
AddLogSystem(fileLog)
|
||
|
|
||
|
stdoutLog := NewStdLogSystem(os.Stdout, 0, WarnLevel)
|
||
|
AddLogSystem(stdoutLog)
|
||
|
|
||
|
NewLogger("TAG").Warnln("reactor meltdown") // writes to both logs
|
||
|
}
|