dummyapp: go.pennock.tech/dummyapp/internal/logging Index | Files

package logging

import "go.pennock.tech/dummyapp/internal/logging"


Package Files

core.go logrus.go

func Enabled Uses

func Enabled() bool

Enabled is a predicate stating if logging is enabled. It has to be usable after flags init but _before_ implSetup, being called by Setup() in core.go to decide if we should be called.

type Logger Uses

type Logger interface {
    WithField(key string, value interface{}) Logger
    WithError(err error) Logger

    // while logrus uses `args ...interface{}`, we push hard enough for
    // structured logging that not only do we not use any of the Foof()
    // variants, but we also only ever call these with one item, a string
    // message for the humans.  EVERYTHING else in our usage must be properly
    // structured, under some key.
    Debug(message string)
    Info(message string)
    Warning(message string)
    Error(message string)

    // IsDisabled is a simple one-liner which real implementations should use
    // to return false, unless they support the concept of disabling.
    IsDisabled() bool

Logger is the interface API which the rest of our code should use for logging. Originally this was a type alias for logrus.FieldLogger, but we now enumerate for ourselves exactly what we do rely upon, so that we have a smaller surface and can drop something else in. As we now do, under certain build tags.

func NilLogger Uses

func NilLogger() Logger

NilLogger returns a typed nil which satisfies Logger but does nothing.

func Setup Uses

func Setup() Logger

Setup is used to setup logging.

Package logging imports 9 packages (graph) and is imported by 3 packages. Updated 2018-03-20. Refresh now. Tools for package owners.