-
Notifications
You must be signed in to change notification settings - Fork 0
/
logLine.go
40 lines (34 loc) · 1.08 KB
/
logLine.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf/protobuf --gogoslick_out=proto logLineMessage.proto
package logger
import (
"time"
"github.com/bhagyaraj1208117/andes-logger-xyz/proto"
)
// LogLine is the structure used to hold a log line
type LogLine struct {
LoggerName string
Correlation proto.LogCorrelationMessage
Message string
LogLevel LogLevel
Args []interface{}
Timestamp time.Time
}
func newLogLine(loggerName string, correlation proto.LogCorrelationMessage, message string, logLevel LogLevel, args ...interface{}) *LogLine {
return &LogLine{
LoggerName: loggerName,
Correlation: correlation,
Message: message,
LogLevel: logLevel,
Args: args,
Timestamp: time.Now(),
}
}
// LogLineWrapper is a wrapper over protobuf.LogLineMessage that enables the structure to be used with
// protobuf marshaller
type LogLineWrapper struct {
proto.LogLineMessage
}
// IsInterfaceNil returns true if there is no value under the interface
func (llw *LogLineWrapper) IsInterfaceNil() bool {
return llw == nil
}