github.com/RajatVaryani/mattermost-server@v5.11.1+incompatible/mlog/human/process.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package human 5 6 import ( 7 "bufio" 8 "io" 9 ) 10 11 type LogWriter interface { 12 Write(e LogEntry) 13 } 14 15 // Read JSON logs from input and write formatted logs to the output 16 func ProcessLogs(reader io.Reader, writer LogWriter) { 17 scanner := bufio.NewScanner(reader) 18 for scanner.Scan() { 19 s := scanner.Text() 20 e := ParseLogMessage(s) 21 writer.Write(e) 22 } 23 }