Skip to content

log: break out the backends? #274

@peterbourgon

Description

@peterbourgon

The question was raised whether we ought to break out the various logging backends to their own packages underneath package log, similar to package metrics. I was initially for the idea, but in mocking out the UX, realized it would have the effect of changing the relatively-nice

import (
    "github.com/go-kit/kit/log"
)

var logger log.Logger
logger = log.NewJSONLogger(os.Stdout)
logger = log.NewContext(logger).With("foo", 123)

to the slightly more awkward

import (
    "github.com/go-kit/kit/log"
    jsonlog "github.com/go-kit/kit/log/json"
)

var logger log.Logger
logger = jsonlog.New(os.Stdout)
logger = log.NewContext(logger).With("foo", 123)

The same critique applies to package metrics, but in that case we have considerably different construction semantics for each of the backends. In this case, packages seem to act purely as namespaces, which I guess is an antipattern.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions