Source File
writer.go
Belonging Package
github.com/sirupsen/logrus
package logrusimport ()// Writer at INFO level. See WriterLevel for details.func ( *Logger) () *io.PipeWriter {return .WriterLevel(InfoLevel)}// WriterLevel returns an io.Writer that can be used to write arbitrary text to// the logger at the given log level. Each line written to the writer will be// printed in the usual way using formatters and hooks. The writer is part of an// io.Pipe and it is the callers responsibility to close the writer when done.// This can be used to override the standard library logger easily.func ( *Logger) ( Level) *io.PipeWriter {return NewEntry().WriterLevel()}func ( *Entry) () *io.PipeWriter {return .WriterLevel(InfoLevel)}func ( *Entry) ( Level) *io.PipeWriter {, := io.Pipe()var func( ...interface{})switch {case TraceLevel:= .Tracecase DebugLevel:= .Debugcase InfoLevel:= .Infocase WarnLevel:= .Warncase ErrorLevel:= .Errorcase FatalLevel:= .Fatalcase PanicLevel:= .Panicdefault:}go .writerScanner(, )runtime.SetFinalizer(, writerFinalizer)return}func ( *Entry) ( *io.PipeReader, func( ...interface{})) {:= bufio.NewScanner()for .Scan() {(.Text())}if := .Err(); != nil {.Errorf("Error while reading from Writer: %s", )}.Close()}func ( *io.PipeWriter) {.Close()}
![]() |
The pages are generated with Golds v0.3.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |