package
6.27.0+incompatible
Repository: https://github.com/clever/kayvee-go.git
Documentation: pkg.go.dev

# README

logger

-- import "gopkg.in/Clever/kayvee-go.v6/logger"

Usage

type Formatter

type Formatter func(data map[string]interface{}) string

Formatter is a function type that takes a map and returns a formatted string with the contents of the map

type LogLevel

type LogLevel int

LogLevel is an enum is used to denote level of logging

const (
	Debug LogLevel = iota
	Info
	Warning
	Error
	Critical
)

Constants used to define different LogLevels supported

func (LogLevel) String

func (l LogLevel) String() string

type Logger

type Logger struct {
}

Logger provides customization of log messages. We can change globals, default log level, formatting, and output destination.

func New

func New(source string) *Logger

New creates a *logger.Logger. Default values are Debug LogLevel, kayvee Formatter, and std.err output.

func (*Logger) Counter

func (l *Logger) Counter(title string)

Counter takes a string and logs with LogLevel = Info, type = counter, and value = 1

func (*Logger) CounterD

func (l *Logger) CounterD(title string, value int, data map[string]interface{})

CounterD takes a string, value, and data map. It logs with LogLevel = Info, type = counter, and value = value

func (*Logger) Critical

func (l *Logger) Critical(title string)

Critical takes a string and logs with LogLevel = Critical

func (*Logger) CriticalD

func (l *Logger) CriticalD(title string, data map[string]interface{})

CriticalD takes a string and data map. It logs with LogLevel = Critical

func (*Logger) Debug

func (l *Logger) Debug(title string)

Debug takes a string and logs with LogLevel = Debug

func (*Logger) DebugD

func (l *Logger) DebugD(title string, data map[string]interface{})

DebugD takes a string and data map. It logs with LogLevel = Debug

func (*Logger) Error

func (l *Logger) Error(title string)

Error takes a string and logs with LogLevel = Error

func (*Logger) ErrorD

func (l *Logger) ErrorD(title string, data map[string]interface{})

ErrorD takes a string and data map. It logs with LogLevel = Error

func (*Logger) GaugeFloat

func (l *Logger) GaugeFloat(title string, value float64)

GaugeFloat takes a string and float value. It logs with LogLevel = Info, type = gauge, and value = value

func (*Logger) GaugeFloatD

func (l *Logger) GaugeFloatD(title string, value float64, data map[string]interface{})

GaugeFloatD takes a string, a float value, and data map. It logs with LogLevel = Info, type = gauge, and value = value

func (*Logger) GaugeInt

func (l *Logger) GaugeInt(title string, value int)

GaugeInt takes a string and integer value. It logs with LogLevel = Info, type = gauge, and value = value

func (*Logger) GaugeIntD

func (l *Logger) GaugeIntD(title string, value int, data map[string]interface{})

GaugeIntD takes a string, an integer value, and data map. It logs with LogLevel = Info, type = gauge, and value = value

func (*Logger) Info

func (l *Logger) Info(title string)

Info takes a string and logs with LogLevel = Info

func (*Logger) InfoD

func (l *Logger) InfoD(title string, data map[string]interface{})

InfoD takes a string and data map. It logs with LogLevel = Info

func (*Logger) SetConfig

func (l *Logger) SetConfig(source string, logLvl LogLevel, formatter Formatter, output io.Writer)

SetConfig allows configuration changes in one go

func (*Logger) SetFormatter

func (l *Logger) SetFormatter(formatter Formatter)

SetFormatter sets the formatter function to use

func (*Logger) SetLogLevel

func (l *Logger) SetLogLevel(logLvl LogLevel)

SetLogLevel sets the default log level threshold

func (*Logger) SetOutput

func (l *Logger) SetOutput(output io.Writer)

SetOutput changes the output destination of the logger

func (*Logger) Warn

func (l *Logger) Warn(title string)

Warn takes a string and logs with LogLevel = Warning

func (*Logger) WarnD

func (l *Logger) WarnD(title string, data map[string]interface{})

WarnD takes a string and data map. It logs with LogLevel = Warning

type M

type M map[string]interface{}

# Packages

No description provided by the author
No description provided by the author

# Functions

FromContext returns the logger value contained in a context.
New creates a *logger.Logger.
NewContext creates a new context object containing a logger value.
NewMockCountLogger returns a new MockRoutCountLogger with the specified `source`.
NewMockCountLoggerWithContext returns a new MockRoutCountLogger with the specified `source` and `contextValues`.
NewWithContext creates a *logger.Logger.
SetGlobalRouting installs a new log router onto the KayveeLogger with the configuration specified in `filename`.
SetGlobalRoutingFromBytes installs a new log router onto the KayveeLogger with the configuration specified in .

# Constants

Constants used to define different LogLevels supported.
Constants used to define different LogLevels supported.
Constants used to define different LogLevels supported.
Constants used to define different LogLevels supported.
Constants used to define different LogLevels supported.
Constants used to define different LogLevels supported.

# Structs

Logger is the default implementation of KayveeLogger.
MockRouteCountLogger is a mock implementation of KayveeLogger that counts the router rules applied to each log call without actually formatting or writing the log line.

# Interfaces

KayveeLogger is the main logging interface, providing customization of log messages.

# Type aliases

Formatter is a function type that takes a map and returns a formatted string with the contents of the map.
LogLevel is an enum is used to denote level of logging.
M is a convenience type for passing data into a log message.