Skip to content

Support | separator for readability #35

Description

@spaceone

I didn't find any real specification of logfmt. But https://www.brandur.org/logfmt seems to be the origin.
It defines the following valid format (and links back to this nice project):

info | Stopping all fetchers          module=kafka.consumer.ConsumerFetcherManager
info | Performing log compaction      module=kafka.compacter.LogCompactionManager
info | Performing garbage collection  module=kafka.cleaner.GarbageCollectionManager
info | Starting all fetchers          module=kafka.consumer.ConsumerFetcherManager

So we have msg, when/time and at separeted from the parameters.
at (level) also has a different length.

For example, we need:

2023-10-27T08:22:57.275138+00:00 INFO  | modified group   | id="..." old={..} new={..} module=app.main.loop pid=13825 request_id=31f863092ade
2023-10-27T08:22:58.123454+00:00 DEBUG | received request | headers={..} method='POST' json={..} module=app.net.http pid=13825 request_id=b0ca915ec433
2023-10-27T08:22:58.351345+00:00 TRACE | cache hit        | hash="..." ttl=... module=app.backend.cache pid=13825 request_id=b0ca915ec433

so after level is a "\t" so that the length is expanded to 8 chars making INFO and DEBUG look like the same length.

→ it should be configurable which args should be treated as non-keyword-args and being | + \t separated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions