summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/logr/target/writer.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-08-05 20:43:19 +0200
committerGitHub <noreply@github.com>2023-08-05 20:43:19 +0200
commit56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (patch)
treeb1355645342667209263cbd355dc0b4254f1e8fe /vendor/github.com/mattermost/logr/target/writer.go
parent9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff)
downloadmatterbridge-msglm-master.tar.gz
matterbridge-msglm-master.tar.bz2
matterbridge-msglm-master.zip
Update dependencies and remove old matterclient lib (#2067)HEADmaster
Diffstat (limited to 'vendor/github.com/mattermost/logr/target/writer.go')
-rw-r--r--vendor/github.com/mattermost/logr/target/writer.go40
1 files changed, 0 insertions, 40 deletions
diff --git a/vendor/github.com/mattermost/logr/target/writer.go b/vendor/github.com/mattermost/logr/target/writer.go
deleted file mode 100644
index 2250da51..00000000
--- a/vendor/github.com/mattermost/logr/target/writer.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package target
-
-import (
- "io"
- "io/ioutil"
-
- "github.com/mattermost/logr"
-)
-
-// Writer outputs log records to any `io.Writer`.
-type Writer struct {
- logr.Basic
- out io.Writer
-}
-
-// NewWriterTarget creates a target capable of outputting log records to an io.Writer.
-func NewWriterTarget(filter logr.Filter, formatter logr.Formatter, out io.Writer, maxQueue int) *Writer {
- if out == nil {
- out = ioutil.Discard
- }
- w := &Writer{out: out}
- w.Basic.Start(w, w, filter, formatter, maxQueue)
- return w
-}
-
-// Write converts the log record to bytes, via the Formatter,
-// and outputs to the io.Writer.
-func (w *Writer) Write(rec *logr.LogRec) error {
- _, stacktrace := w.IsLevelEnabled(rec.Level())
-
- buf := rec.Logger().Logr().BorrowBuffer()
- defer rec.Logger().Logr().ReleaseBuffer(buf)
-
- buf, err := w.Formatter().Format(rec, stacktrace, buf)
- if err != nil {
- return err
- }
- _, err = w.out.Write(buf.Bytes())
- return err
-}