diff --git a/util/elog/log.go b/util/elog/log.go index 27d76c2c5..ea9ccbf22 100644 --- a/util/elog/log.go +++ b/util/elog/log.go @@ -12,8 +12,24 @@ func init() { SetupLogging() } +// EventLogger extends the StandardLogger interface to allow for log items +// containing structured metadata type EventLogger interface { StandardLogger + + // Event merges structured data from the provided inputs into a single + // machine-readable log event. + // + // If the context contains metadata, a copy of this is used as the base + // metadata accumulator. + // + // If one or more loggable objects are provided, these are deep-merged into base blob. + // + // Next, the event name is added to the blob under the key "event". If + // the key "event" already exists, it will be over-written. + // + // Finally the timestamp and package name are added to the accumulator and + // the metadata is logged. Event(ctx context.Context, event string, m ...Loggable) }