added to docs
parent
3c7d9e0d6d
commit
5b4df795d1
32
doc.go
32
doc.go
|
@ -9,7 +9,7 @@ Basic usage of the flogger looks like this:
|
||||||
|
|
||||||
flogger := flog.New(router)
|
flogger := flog.New(router)
|
||||||
|
|
||||||
Once you have this, you can do things such as:
|
Once you have the flogger, you can do things such as:
|
||||||
|
|
||||||
flogger.Print("Hello world!")
|
flogger.Print("Hello world!")
|
||||||
flogger.Println("Hello world!")
|
flogger.Println("Hello world!")
|
||||||
|
@ -24,5 +24,35 @@ Once you have this, you can do things such as:
|
||||||
flogger.Fatalf("Something really bad happened: %s.", problemDescription)
|
flogger.Fatalf("Something really bad happened: %s.", problemDescription)
|
||||||
|
|
||||||
|
|
||||||
|
Deployment Environment
|
||||||
|
|
||||||
|
Of course in a real application system you should (probably) create a different kind
|
||||||
|
of flogger for each deployment environment.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
var flogger flog.Flogger
|
||||||
|
|
||||||
|
switch deploymentEnvironment {
|
||||||
|
case "DEV":
|
||||||
|
router := NewPrettyWritingRouter(os.Stdout)
|
||||||
|
|
||||||
|
flogger = flog.New(router)
|
||||||
|
case "PROD":
|
||||||
|
verboseRouter = flog.NewDiscardingRouter()
|
||||||
|
if isVerboseMode {
|
||||||
|
verboseRouter = NewCustomVerboseRouter()
|
||||||
|
}
|
||||||
|
|
||||||
|
panicDetectionRouter := flog.NewFilteringRouter(NewCustomerPanicRecordingRouter(), filterOnlyPanicsFunc)
|
||||||
|
|
||||||
|
errorDetectionRouter := flog.NewFilteringRouter(NewCustomerPanicRecordingRouter(), filterOnlyErrorsFunc)
|
||||||
|
|
||||||
|
router := NewFanoutRouter(verboseRouter, panicDetectionRouter, errorDetectionRouter)
|
||||||
|
|
||||||
|
flogger = flog.New(router)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package flog
|
package flog
|
||||||
|
|
Loading…
Reference in New Issue