logger

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// JSONLogFormat is json based logging format
	JSONLogFormat = iota
	// SyslogLogFormat is syslog based logging format
	SyslogLogFormat
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format int

Format defines the logger format

type Handler

type Handler interface {
	Info(description ...interface{})
	Debug(description ...interface{})
	Warn(err error)
	Error(err error)
	WithField(string, interface{}) *Logger
	WithFields(map[string]interface{}) *Logger
}

Handler is the interface for bucky logger

func New

func New(appname string, opts Options) (Handler, error)

New instantiates bucky logger instance

type Logger

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

Logger is the implementation of Handler interface

func (*Logger) Debug

func (l *Logger) Debug(description ...interface{})

Debug logs for log-level debug

func (*Logger) Error

func (l *Logger) Error(err error)

Error logs for log-level error

func (*Logger) Info

func (l *Logger) Info(description ...interface{})

Info logs for log-level info

func (*Logger) Warn

func (l *Logger) Warn(err error)

Warn logs for log-level warning

func (*Logger) WithField

func (l *Logger) WithField(s string, val interface{}) *Logger

WithField logs with added field

func (*Logger) WithFields

func (l *Logger) WithFields(d map[string]interface{}) *Logger

WithFields logs with given added fields

type Options

type Options struct {
	Format     Format
	DebugLevel bool
}

Options supports different custom parameters for logger

Jump to

Keyboard shortcuts

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