Moving mlog to corelibs (#16915)
* Moving mlog to corelibs * Regenerating app layers * Fix golangci-lint problem * Fixing golangci-lint errors * Renaming from corelibs to shared * Renaming from corelibs to shared * Fixing import * Fixing merge problems * Fixing build
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b3498a1edf
Коммит
9cc5089af8
23
shared/mlog/human/process.go
Обычный файл
23
shared/mlog/human/process.go
Обычный файл
@@ -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)
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user