snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
This commit is contained in:
53
server/cmd/mmctl/printer/human/entry.go
Normal file
53
server/cmd/mmctl/printer/human/entry.go
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package human
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/printer"
|
||||
)
|
||||
|
||||
type LogEntry struct {
|
||||
Time time.Time
|
||||
Level string
|
||||
Message string
|
||||
Caller string
|
||||
Fields []mlog.Field
|
||||
}
|
||||
|
||||
// Provide default string representation. Used by SimpleWriter
|
||||
func (f LogEntry) String() string {
|
||||
var sb strings.Builder
|
||||
if !f.Time.IsZero() {
|
||||
sb.WriteString(f.Time.Format(time.RFC3339Nano))
|
||||
sb.WriteRune(' ')
|
||||
}
|
||||
if f.Level != "" {
|
||||
sb.WriteString(f.Level)
|
||||
sb.WriteRune(' ')
|
||||
}
|
||||
if f.Caller != "" {
|
||||
sb.WriteString(f.Caller)
|
||||
sb.WriteRune(' ')
|
||||
}
|
||||
for _, field := range f.Fields {
|
||||
sb.WriteString(field.Key)
|
||||
sb.WriteRune('=')
|
||||
sb.WriteString(fmt.Sprint(field.Interface))
|
||||
sb.WriteRune(' ')
|
||||
}
|
||||
if f.Message != "" {
|
||||
// If the message is multiple lines, start the whole message on a new line
|
||||
if strings.ContainsRune(f.Message, '\n') {
|
||||
sb.WriteRune('\n')
|
||||
}
|
||||
sb.WriteString(f.Message)
|
||||
}
|
||||
|
||||
return printer.SanitizeForTerminal(sb.String())
|
||||
}
|
||||
95
server/cmd/mmctl/printer/human/entry_test.go
Normal file
95
server/cmd/mmctl/printer/human/entry_test.go
Normal file
@@ -0,0 +1,95 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package human
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestLogEntryString(t *testing.T) {
|
||||
baseTime := time.Date(2024, time.January, 2, 3, 4, 5, 0, time.UTC)
|
||||
|
||||
t.Run("plain entry renders as expected", func(t *testing.T) {
|
||||
entry := LogEntry{
|
||||
Time: baseTime,
|
||||
Level: "info",
|
||||
Message: "hello world",
|
||||
Caller: "main.go:10",
|
||||
Fields: []mlog.Field{{Key: "key", Interface: "value"}},
|
||||
}
|
||||
|
||||
got := entry.String()
|
||||
assert.Contains(t, got, "info")
|
||||
assert.Contains(t, got, "main.go:10")
|
||||
assert.Contains(t, got, "key=value")
|
||||
assert.Contains(t, got, "hello world")
|
||||
})
|
||||
|
||||
t.Run("strips ANSI CSI sequences from message", func(t *testing.T) {
|
||||
entry := LogEntry{
|
||||
Time: baseTime,
|
||||
Level: "info",
|
||||
Message: "\x1b[31mRed Text\x1b[0m",
|
||||
}
|
||||
|
||||
got := entry.String()
|
||||
assert.NotContains(t, got, "\x1b")
|
||||
assert.Contains(t, got, "Red Text")
|
||||
})
|
||||
|
||||
t.Run("strips OSC sequences (clipboard hijacking) from message", func(t *testing.T) {
|
||||
entry := LogEntry{
|
||||
Time: baseTime,
|
||||
Level: "error",
|
||||
Message: "invalid token: Normal text\x1b]52;c;SGVsbG8gV29ybGQ=\x07more text",
|
||||
}
|
||||
|
||||
got := entry.String()
|
||||
assert.NotContains(t, got, "\x1b")
|
||||
assert.NotContains(t, got, "\x07")
|
||||
assert.Contains(t, got, "Normal textmore text")
|
||||
})
|
||||
|
||||
t.Run("strips escape sequences injected via fields", func(t *testing.T) {
|
||||
entry := LogEntry{
|
||||
Time: baseTime,
|
||||
Level: "info",
|
||||
Fields: []mlog.Field{{Key: "token", Interface: "\x1b]0;Fake Title\x07abc123"}},
|
||||
}
|
||||
|
||||
got := entry.String()
|
||||
assert.NotContains(t, got, "\x1b")
|
||||
require.Contains(t, got, "token=")
|
||||
assert.Contains(t, got, "abc123")
|
||||
})
|
||||
|
||||
t.Run("strips other control characters", func(t *testing.T) {
|
||||
entry := LogEntry{
|
||||
Time: baseTime,
|
||||
Level: "info",
|
||||
Message: "some\x00bytes\x7fhere",
|
||||
}
|
||||
|
||||
got := entry.String()
|
||||
assert.NotContains(t, got, "\x00")
|
||||
assert.NotContains(t, got, "\x7f")
|
||||
assert.Contains(t, got, "somebyteshere")
|
||||
})
|
||||
|
||||
t.Run("preserves multi-line messages", func(t *testing.T) {
|
||||
entry := LogEntry{
|
||||
Time: baseTime,
|
||||
Level: "info",
|
||||
Message: "line 1\nline 2",
|
||||
}
|
||||
|
||||
got := entry.String()
|
||||
assert.Contains(t, got, "line 1\nline 2")
|
||||
})
|
||||
}
|
||||
77
server/cmd/mmctl/printer/human/logrus_writer.go
Normal file
77
server/cmd/mmctl/printer/human/logrus_writer.go
Normal file
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package human
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type LogrusWriter struct {
|
||||
logger *logrus.Logger
|
||||
}
|
||||
|
||||
func (w *LogrusWriter) Write(e LogEntry) {
|
||||
if e.Level == "" {
|
||||
fmt.Fprintln(w.logger.Out, e.Message)
|
||||
return
|
||||
}
|
||||
|
||||
lvl, err := logrus.ParseLevel(e.Level)
|
||||
if err != nil {
|
||||
fmt.Fprintln(w.logger.Out, err)
|
||||
lvl = logrus.TraceLevel + 1 // will invoke Println
|
||||
}
|
||||
|
||||
logger := w.logger.WithTime(e.Time)
|
||||
|
||||
if e.Caller != "" {
|
||||
// logrus has a system of reporting the caller, but there's no easy way to override it
|
||||
logger = logger.WithField("caller", e.Caller)
|
||||
}
|
||||
|
||||
for _, field := range e.Fields {
|
||||
logger = logger.WithField(field.Key, field.Interface)
|
||||
}
|
||||
|
||||
switch lvl {
|
||||
case logrus.PanicLevel:
|
||||
// Prevent panic from causing us to exit
|
||||
defer func() {
|
||||
_ = recover()
|
||||
}()
|
||||
logger.Panic(e.Message)
|
||||
case logrus.FatalLevel:
|
||||
logger.Fatal(e.Message)
|
||||
case logrus.ErrorLevel:
|
||||
logger.Error(e.Message)
|
||||
case logrus.WarnLevel:
|
||||
logger.Warn(e.Message)
|
||||
case logrus.InfoLevel:
|
||||
logger.Info(e.Message)
|
||||
case logrus.DebugLevel:
|
||||
logger.Debug(e.Message)
|
||||
case logrus.TraceLevel:
|
||||
logger.Trace(e.Message)
|
||||
default:
|
||||
logger.Println(e.Message)
|
||||
}
|
||||
}
|
||||
|
||||
func NewLogrusWriter(output io.Writer) *LogrusWriter {
|
||||
w := new(LogrusWriter)
|
||||
w.logger = logrus.New()
|
||||
w.logger.SetLevel(logrus.TraceLevel) // don't filter any logs
|
||||
w.logger.ExitFunc = func(int) {} // prevent Fatal from causing us to exit
|
||||
w.logger.SetReportCaller(false)
|
||||
w.logger.SetOutput(output)
|
||||
var tf logrus.TextFormatter
|
||||
tf.FullTimestamp = true
|
||||
tf.TimestampFormat = time.RFC3339Nano
|
||||
w.logger.SetFormatter(&tf)
|
||||
return w
|
||||
}
|
||||
180
server/cmd/mmctl/printer/human/parser.go
Normal file
180
server/cmd/mmctl/printer/human/parser.go
Normal file
@@ -0,0 +1,180 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package human
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
)
|
||||
|
||||
func ParseLogMessage(msg string) LogEntry {
|
||||
result, err := parseLogMessage(msg)
|
||||
if err != nil {
|
||||
// If failed to parse, just output a LogEntry where all fields are blank, but Message is the original string
|
||||
var result2 LogEntry
|
||||
result2.Message = msg
|
||||
return result2
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func parseLogMessage(msg string) (result LogEntry, err error) {
|
||||
// Note: This implementation uses a custom json decoding loop.
|
||||
// The primary advantage of this versus decoding directly into a map is to
|
||||
// preserve the order of the fields. This can be simplified if we end up
|
||||
// having the formatter sort fields alphabetically (logrus does by default)
|
||||
|
||||
dec := json.NewDecoder(strings.NewReader(msg))
|
||||
|
||||
// look for an initial "{"
|
||||
token, err := dec.Token()
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
d, ok := token.(json.Delim)
|
||||
if !ok || d != '{' {
|
||||
return result, fmt.Errorf("input is not a JSON object, found: %v", token)
|
||||
}
|
||||
|
||||
// read all key-value pairs
|
||||
for dec.More() {
|
||||
key, err2 := dec.Token()
|
||||
if err2 != nil {
|
||||
return result, err2
|
||||
}
|
||||
skey, ok2 := key.(string)
|
||||
if !ok2 {
|
||||
return result, errors.New("key is not a value string")
|
||||
}
|
||||
if !dec.More() {
|
||||
return result, errors.New("missing value pair")
|
||||
}
|
||||
|
||||
switch skey {
|
||||
case "ts":
|
||||
var ts json.Number
|
||||
if err2 := dec.Decode(&ts); err2 != nil {
|
||||
return result, err2
|
||||
}
|
||||
timeVal, err2 := numberToTime(ts)
|
||||
if err2 != nil {
|
||||
return result, err2
|
||||
}
|
||||
result.Time = timeVal
|
||||
|
||||
case "level":
|
||||
s, err2 := decodeAsString(dec)
|
||||
if err2 != nil {
|
||||
return result, err2
|
||||
}
|
||||
result.Level = s
|
||||
|
||||
case "msg":
|
||||
s, err2 := decodeAsString(dec)
|
||||
if err2 != nil {
|
||||
return result, err2
|
||||
}
|
||||
result.Message = s
|
||||
|
||||
case "caller":
|
||||
s, err2 := decodeAsString(dec)
|
||||
if err2 != nil {
|
||||
return result, err2
|
||||
}
|
||||
result.Caller = s
|
||||
|
||||
default:
|
||||
var p any
|
||||
if err2 := dec.Decode(&p); err2 != nil {
|
||||
return result, err2
|
||||
}
|
||||
var f mlog.Field
|
||||
f.Key = skey
|
||||
f.Interface = p
|
||||
result.Fields = append(result.Fields, f)
|
||||
}
|
||||
}
|
||||
|
||||
// read the "}"
|
||||
token, err = dec.Token()
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
d, ok = token.(json.Delim)
|
||||
if !ok || d != '}' {
|
||||
return result, fmt.Errorf("failed to read '}', read: %v", token)
|
||||
}
|
||||
|
||||
// make sure nothing else trailing
|
||||
if token, err := dec.Token(); err != io.EOF {
|
||||
return result, err
|
||||
} else if token != nil {
|
||||
return result, errors.New("found trailing data")
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Translate a number into a time
|
||||
func numberToTime(v json.Number) (time.Time, error) {
|
||||
// Using floating point math to extract the nanoseconds leads to a time that doesn't exactly match the input
|
||||
// Instead, parse out the components from the string representation
|
||||
|
||||
var t time.Time
|
||||
|
||||
// First make sure it is a number...
|
||||
flt, err := v.Float64()
|
||||
if err != nil {
|
||||
return t, err
|
||||
}
|
||||
|
||||
s := v.String()
|
||||
|
||||
if strings.ContainsAny(s, "eE") {
|
||||
// input is in scientific notation. Convert to standard decimal notation
|
||||
s = strconv.FormatFloat(flt, 'f', -1, 64)
|
||||
}
|
||||
|
||||
// extract the seconds and nanoseconds separately
|
||||
var nanos, sec int64
|
||||
|
||||
parts := strings.SplitN(s, ".", 2)
|
||||
sec, err = strconv.ParseInt(parts[0], 10, 64)
|
||||
if err != nil {
|
||||
return t, err
|
||||
}
|
||||
|
||||
if len(parts) == 2 {
|
||||
nanosText := parts[1] + "000000000"
|
||||
nanosText = nanosText[:9]
|
||||
nanos, err = strconv.ParseInt(nanosText, 10, 64)
|
||||
if err != nil {
|
||||
return t, err
|
||||
}
|
||||
}
|
||||
|
||||
t = time.Unix(sec, nanos)
|
||||
return t, nil
|
||||
}
|
||||
|
||||
// Decodes a value from JSON, coercing it to a string value as necessary
|
||||
func decodeAsString(dec *json.Decoder) (s string, err error) {
|
||||
var v any
|
||||
if err = dec.Decode(&v); err != nil {
|
||||
return s, err
|
||||
}
|
||||
var ok bool
|
||||
if s, ok = v.(string); ok {
|
||||
return s, err
|
||||
}
|
||||
s = fmt.Sprint(v)
|
||||
return s, err
|
||||
}
|
||||
23
server/cmd/mmctl/printer/human/process.go
Normal file
23
server/cmd/mmctl/printer/human/process.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package human
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
)
|
||||
|
||||
type LogWriter interface {
|
||||
Write(e LogEntry)
|
||||
}
|
||||
|
||||
// Read JSON logs from input and write formatted logs to the output
|
||||
func ProcessLogs(reader io.Reader, writer LogWriter) {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
for scanner.Scan() {
|
||||
s := scanner.Text()
|
||||
e := ParseLogMessage(s)
|
||||
writer.Write(e)
|
||||
}
|
||||
}
|
||||
23
server/cmd/mmctl/printer/human/simple_writer.go
Normal file
23
server/cmd/mmctl/printer/human/simple_writer.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package human
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
type SimpleWriter struct {
|
||||
out io.Writer
|
||||
}
|
||||
|
||||
func (w *SimpleWriter) Write(e LogEntry) {
|
||||
fmt.Fprintln(w.out, e)
|
||||
}
|
||||
|
||||
func NewSimpleWriter(out io.Writer) *SimpleWriter {
|
||||
w := new(SimpleWriter)
|
||||
w.out = out
|
||||
return w
|
||||
}
|
||||
Reference in New Issue
Block a user