go-composite-logger: github.com/spatialcurrent/go-composite-logger/compositelogger Index | Files

package compositelogger

import "github.com/spatialcurrent/go-composite-logger/compositelogger"

Index

Package Files

CompositeLogger.go LogConfig.go

func OpenOutput Uses

func OpenOutput(location string) (io.Writer, error)

OpenOutput returns an io.Writer for a given location to log. If there is an error, returns the error.

type CompositeLogger Uses

type CompositeLogger struct {
    Logs []*logrus.Logger // array of loggers
}

CompositeLogger is a struct containing an array of loggers.

func NewCompositeLogger Uses

func NewCompositeLogger(logConfigs []*LogConfig) (*CompositeLogger, error)

NewCompositeLogger returns a composite logger for an array of log configurations. If there is an error, returns the error.

func NewDefaultLogger Uses

func NewDefaultLogger() (*CompositeLogger, error)

NewDefaultLogger returns a default composite logger, with stdout/info and stderr/warning. If there is an error, returns the error.

func (*CompositeLogger) Add Uses

func (l *CompositeLogger) Add(location string, format string, level string) error

Add adds a new logger to the composite logger, specified by the parameters. Returns an error, if any.

func (*CompositeLogger) Fatal Uses

func (l *CompositeLogger) Fatal(msg interface{})

Info logs a message with level FATAL to all loggers.

func (*CompositeLogger) Info Uses

func (l *CompositeLogger) Info(msg interface{})

Info logs a message with level INFO to all loggers.

func (*CompositeLogger) InfoWithFields Uses

func (l *CompositeLogger) InfoWithFields(msg interface{}, fields map[string]interface{})

InfoWithFields logs a message with level INFO and a map of fields to all loggers.

func (*CompositeLogger) Warn Uses

func (l *CompositeLogger) Warn(msg interface{})

Info logs a message with level WARN to all loggers.

func (*CompositeLogger) WarnWithFields Uses

func (l *CompositeLogger) WarnWithFields(msg interface{}, fields map[string]interface{})

InfoWithFields logs a message with level WARN and a map of fields to all loggers.

type LogConfig Uses

type LogConfig struct {
    Location string `json:"location" bson:"location" yaml:"location" hcl:"location"` // location of the log
    Level    string `json:"level" bson:"level" yaml:"level" hcl:"level"`             // level of the log: INFO, WARN, DEBUG, etc.
    Format   string `json:"format" bson:"format" yaml:"format" hcl:"format"`         // text or json
}

LogConfig is a struct containing the configuration for an individual log.

Package compositelogger imports 9 packages (graph) and is imported by 1 packages. Updated 2018-07-05. Refresh now. Tools for package owners.