golanggohlsrtmpwebrtcmedia-serverobs-studiortcprtmp-proxyrtmp-serverrtprtsprtsp-proxyrtsp-relayrtsp-serversrtstreamingwebrtc-proxy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
582 B
32 lines
582 B
package logger |
|
|
|
import ( |
|
"bytes" |
|
"os" |
|
"time" |
|
|
|
"golang.org/x/term" |
|
) |
|
|
|
type destinationStdout struct { |
|
useColor bool |
|
|
|
buf bytes.Buffer |
|
} |
|
|
|
func newDestionationStdout() destination { |
|
return &destinationStdout{ |
|
useColor: term.IsTerminal(int(os.Stdout.Fd())), |
|
} |
|
} |
|
|
|
func (d *destinationStdout) log(t time.Time, level Level, format string, args ...interface{}) { |
|
d.buf.Reset() |
|
writeTime(&d.buf, t, d.useColor) |
|
writeLevel(&d.buf, level, d.useColor) |
|
writeContent(&d.buf, format, args) |
|
os.Stdout.Write(d.buf.Bytes()) //nolint:errcheck |
|
} |
|
|
|
func (d *destinationStdout) close() { |
|
}
|
|
|