2019-03-06 20:13:50 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/btcsuite/btclog"
|
|
|
|
)
|
|
|
|
|
2019-03-07 04:32:24 +00:00
|
|
|
// log is a logger that is initialized with no output filters. This means the
|
|
|
|
// package will not perform any logging by default until the caller requests
|
|
|
|
// it.
|
2019-03-06 20:13:50 +00:00
|
|
|
var (
|
|
|
|
backendLog = btclog.NewBackend(logWriter{})
|
2019-03-07 10:37:28 +00:00
|
|
|
logger = backendLog.Logger("LOOPD")
|
2019-03-06 20:13:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// logWriter implements an io.Writer that outputs to both standard output and
|
|
|
|
// the write-end pipe of an initialized log rotator.
|
|
|
|
type logWriter struct{}
|
|
|
|
|
|
|
|
func (logWriter) Write(p []byte) (n int, err error) {
|
|
|
|
os.Stdout.Write(p)
|
|
|
|
return len(p), nil
|
|
|
|
}
|