docs(elog/Event)
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Brian Tiger Chow committed
Nov 15, 2014 at 19:12 UTC
a84ddcf93289660e31bf891c312dcae12e9d5157
1 file changed
+16
util/elog/log.go
+16
@@ -12,8 +12,24 @@ func init() {
12
SetupLogging()
13
}
14
15
+// EventLogger extends the StandardLogger interface to allow for log items
16
+// containing structured metadata
17
type EventLogger interface {
18
StandardLogger
19
+
20
+ // Event merges structured data from the provided inputs into a single
21
+ // machine-readable log event.
22
+ //
23
+ // If the context contains metadata, a copy of this is used as the base
24
+ // metadata accumulator.
25
+ //
26
+ // If one or more loggable objects are provided, these are deep-merged into base blob.
27
+ //
28
+ // Next, the event name is added to the blob under the key "event". If
29
+ // the key "event" already exists, it will be over-written.
30
+ //
31
+ // Finally the timestamp and package name are added to the accumulator and
32
+ // the metadata is logged.
33
Event(ctx context.Context, event string, m ...Loggable)
34
}
35