Exemple #1
0
func main() {
	dispatcher, err := log.CreateLoggingFromFile("logoon.json")
	if err != nil {
		panic(err)
	}

	accessLog := logSource.MakeTaggedLogSource(dispatcher, []string{"access"})
	accessLog.Info("Access I")  //this should be visible in ./access.log
	accessLog.Error("Access E") //this should be visible in ./access.log

	consoleLog := logSource.MakeTaggedLogSource(dispatcher, []string{"console"})
	consoleLog.Info("Console Info")   //this should be visible in console
	consoleLog.Error("Console Error") //this should be visible in console

	errorLog := logSource.MakeSimpleLogSource(dispatcher)
	errorLog.Info("Error Info")   //this be discarded
	errorLog.Error("Error Error") //this should be visible in ./error.log

	time.Sleep(100)
}
Exemple #2
0
func CreateSimpleLogger(dispatcher core.Dispatcher) Logger {
	if dispatcher == nil {
		dispatcher = globalDispatcher
	}
	return source.MakeSimpleLogSource(dispatcher)
}