Skip to content

is it possible to have a fixed key, such as 'msg' #8

@chenzhiwei

Description

@chenzhiwei

A log message usually have a description, which is not key=value format, such as:

successfully created an object, name=obj1

Translate to go-kit log format:

msg="successfully created an object" name=obj1

The key "msg" can be fixed.

Something like Log(msg string, keysAndValues ...interface{})

In prometheus code: https://github.com/prometheus/prometheus/blob/main/tsdb/head.go#L466-L491

level.Info(h.logger).Log("msg", "Replaying on-disk memory mappable chunks if any")
level.Info(h.logger).Log("msg", "Chunk snapshot is enabled, replaying from the snapshot")
level.Info(h.logger).Log("msg", "Chunk snapshot loading time", "duration", time.Since(start).String())
level.Error(h.logger).Log("msg", "Failed to load chunk snapshot", "err", err)

The key "msg" is redundant here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions