slog

package
v0.0.0-...-1c8de56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorScheme

type ColorScheme struct {
	InfoLevelStyle  string
	WarnLevelStyle  string
	ErrorLevelStyle string
	FatalLevelStyle string
	PanicLevelStyle string
	DebugLevelStyle string
	PrefixStyle     string
	TimestampStyle  string
}

type Log

type Log struct {
	// contains filtered or unexported fields
}

Log implements Logger interface

func (*Log) Configure

func (log *Log) Configure(logconf *conf.Log) (err error)

Configure configures logger

func (*Log) GetLogger

func (log *Log) GetLogger() (logrus *logrus.Logger)

GetLogger returns encapsulated logrus instance

func (*Log) Out

func (log *Log) Out(level logrus.Level, fields logrus.Fields, args ...interface{}) (err error)

Out Logger interface implementation

func (*Log) SetLevel

func (log *Log) SetLevel(level logrus.Level)

SetLevel sets the console flat.

type Logger

type Logger interface {
	Out(level logrus.Level, fields logrus.Fields, args ...interface{}) (err error)
	GetLogger() (logr *logrus.Logger)
	Configure(logconf *conf.Log) (err error)
	SetLevel(logrus.Level)
}

Logger sends output to log file.

func NewLogger

func NewLogger() (logger Logger, err error)

NewLogger creates new logger

type SlingTextFormatter

type SlingTextFormatter struct {
	// Set to true to bypass checking for a TTY before outputting colors.
	ForceColors bool

	// Force disabling colors. For a TTY colors are enabled by default.
	DisableColors bool

	// Force formatted layout, even for non-TTY output.
	ForceFormatting bool

	// Disable timestamp logging. useful when output is redirected to logging
	// system that already adds timestamps.
	DisableTimestamp bool

	// Disable the conversion of the log levels to uppercase
	DisableUppercase bool

	// Enable logging the full timestamp when a TTY is attached instead of just
	// the time passed since beginning of execution.
	FullTimestamp bool

	// Timestamp format to use for display when a full timestamp is printed.
	TimestampFormat string

	// The fields are sorted by default for a consistent output. For applications
	// that log extremely frequently and don't use the JSON formatter this may not
	// be desired.
	DisableSorting bool

	// Wrap empty fields in quotes if true.
	QuoteEmptyFields bool

	// Can be set to the override the default quoting character "
	// with something else. For example: ', or `.
	QuoteCharacter string

	// Pad msg field with spaces on the right for display.
	// The value for this parameter will be the size of padding.
	// Its default value is zero, which means no padding will be applied for msg.
	SpacePadding int

	sync.Once
	// contains filtered or unexported fields
}

func (*SlingTextFormatter) Format

func (f *SlingTextFormatter) Format(entry *logrus.Entry) ([]byte, error)

func (*SlingTextFormatter) SetColorScheme

func (f *SlingTextFormatter) SetColorScheme(colorScheme *ColorScheme)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL