github.com/decred/dcrlnd@v0.7.6/build/log_default.go (about) 1 //go:build !stdlog && !nolog && !filelog 2 // +build !stdlog,!nolog,!filelog 3 4 package build 5 6 import ( 7 "io" 8 "os" 9 ) 10 11 // LoggingType is a log type that writes to both stdout and the log rotator, if 12 // present. 13 const LoggingType = LogTypeDefault 14 15 // Stdout is the writer used to actually output data of the app. By default, 16 // this is the stdout file. 17 var Stdout io.Writer = os.Stdout 18 19 // Write writes the byte slice to both stdout and the log rotator, if present. 20 func (w *LogWriter) Write(b []byte) (int, error) { 21 Stdout.Write(b) 22 if w.RotatorPipe != nil { 23 w.RotatorPipe.Write(b) 24 } 25 return len(b), nil 26 }