Skip to content

Commit 2c65464

Browse files
authored
Define and document log.type (#202)
1 parent f4cb3fd commit 2c65464

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

logp/typedloggercore.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ import (
2323
"go.uber.org/zap/zapcore"
2424
)
2525

26+
// TypeKey is the default key to define log types.
27+
//
28+
// Different log types can be handled by different cores, the `typedLoggerCore`
29+
// allows for choosing a different core based on a key/value pair. TypeKey
30+
// is the default key for using the typedLoggerCore.
31+
//
32+
// It should be used in conjunction with the defined types on this package.
33+
const TypeKey = "log.type"
34+
35+
// DefaultType is the default log type. If `log.type` is not defined a log
36+
// entry is considered of type `DefaultType`. Those log entries should follow
37+
// the default logging configuration.
38+
const DefaultType = "default"
39+
40+
// EventType is the type for log entries containing event data.
41+
// Beats and Elastic-Agent use this with the `typedLoggerCore` to direct
42+
// those log entries to a different file.
43+
const EventType = "event"
44+
2645
// typedLoggerCore takes two cores and directs logs entries to one of them
2746
// with the value of the field defined by the pair `key` and `value`
2847
//

0 commit comments

Comments
 (0)