gologger

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 10 Imported by: 5

README

gologger

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOSEnvMap

func GetOSEnvMap() map[string]string

Types

type AbstractLogger

type AbstractLogger struct {
	Logger
}

func (*AbstractLogger) Close

func (s *AbstractLogger) Close()

func (*AbstractLogger) Debug

func (s *AbstractLogger) Debug(args ...interface{})

func (*AbstractLogger) Debugf

func (s *AbstractLogger) Debugf(format string, args ...interface{})

func (*AbstractLogger) Error

func (s *AbstractLogger) Error(args ...interface{})

func (*AbstractLogger) Errorf

func (s *AbstractLogger) Errorf(format string, args ...interface{})

func (*AbstractLogger) Fatal

func (s *AbstractLogger) Fatal(args ...interface{})

func (*AbstractLogger) Fatalf

func (s *AbstractLogger) Fatalf(format string, args ...interface{})

func (*AbstractLogger) Info

func (s *AbstractLogger) Info(args ...interface{})

func (*AbstractLogger) Infof

func (s *AbstractLogger) Infof(format string, args ...interface{})

func (*AbstractLogger) Logf

func (s *AbstractLogger) Logf(level Level, format string, args ...interface{})

func (*AbstractLogger) Warning

func (s *AbstractLogger) Warning(args ...interface{})

func (*AbstractLogger) Warningf

func (s *AbstractLogger) Warningf(format string, args ...interface{})

func (*AbstractLogger) WithError

func (s *AbstractLogger) WithError(err error) Logger

func (*AbstractLogger) WithField

func (s *AbstractLogger) WithField(key string, value interface{}) Logger

func (*AbstractLogger) WithRequest

func (s *AbstractLogger) WithRequest(req *http.Request) Logger

type ArrayLogger

type ArrayLogger struct {
	*AbstractLogger
	// contains filtered or unexported fields
}

func NewArrayLogger

func NewArrayLogger(level Level) *ArrayLogger

func (*ArrayLogger) Clone

func (s *ArrayLogger) Clone() *ArrayLogger

func (*ArrayLogger) Log

func (s *ArrayLogger) Log(level Level, args ...interface{})

func (*ArrayLogger) Storage

func (s *ArrayLogger) Storage() []string

func (*ArrayLogger) WithError

func (s *ArrayLogger) WithError(err error) Logger

func (*ArrayLogger) WithFields

func (s *ArrayLogger) WithFields(fields Fields) Logger

func (*ArrayLogger) WithRequest

func (s *ArrayLogger) WithRequest(req *http.Request) Logger

type Clonable

type Clonable interface {
	Clone() interface{}
}

type Creator

type Creator struct {
	Prefix string
	Env    map[string]string
}

func (Creator) Create

func (c Creator) Create() (Logger, error)

func (Creator) GetEnv

func (c Creator) GetEnv(key string, def string) string

func (Creator) NewArrayLogger

func (c Creator) NewArrayLogger() (Logger, error)

func (Creator) NewLogChannel

func (c Creator) NewLogChannel(channel string) (Logger, error)

func (Creator) NewNullLogger

func (c Creator) NewNullLogger() Logger

func (Creator) NewRollbar

func (c Creator) NewRollbar() (*rollbar.Client, error)

func (Creator) NewRollbarLogger

func (c Creator) NewRollbarLogger(r *rollbar.Client) (Logger, error)

func (Creator) NewSentryHub

func (c Creator) NewSentryHub() (*sentry.Hub, error)

func (Creator) NewSentryLogger

func (c Creator) NewSentryLogger(s *sentry.Hub) (Logger, error)

func (Creator) NewStackLogger

func (c Creator) NewStackLogger() (Logger, error)

func (Creator) NewStderrLogger

func (c Creator) NewStderrLogger() (Logger, error)

func (Creator) NewStdoutLogger

func (c Creator) NewStdoutLogger() (Logger, error)

type Fields

type Fields map[string]interface{}

func (Fields) Clone

func (f Fields) Clone() Fields

type Level

type Level string
const (
	LevelDebug   Level = "debug"
	LevelInfo    Level = "info"
	LevelWarning Level = "warning"
	LevelError   Level = "error"
	LevelFatal   Level = "fatal"
)

func ParseLevel

func ParseLevel(lvl string) (Level, error)

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	WithField(key string, value interface{}) Logger
	WithFields(fields Fields) Logger
	WithError(err error) Logger
	WithRequest(req *http.Request) Logger

	Log(level Level, args ...interface{})

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})

	Debug(args ...interface{})
	Info(args ...interface{})
	Warning(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})

	Close()
}

type LogrusLogger

type LogrusLogger struct {
	*AbstractLogger
	// contains filtered or unexported fields
}

func NewLogrusLogger

func NewLogrusLogger(logger logrus.FieldLogger) *LogrusLogger

func NewStdoutLogger

func NewStdoutLogger(lvl Level) *LogrusLogger

func (*LogrusLogger) Log

func (s *LogrusLogger) Log(level Level, args ...interface{})

func (*LogrusLogger) WithFields

func (s *LogrusLogger) WithFields(fields Fields) Logger

type NullLogger

type NullLogger struct {
	*AbstractLogger
}

func NewNullLogger

func NewNullLogger() *NullLogger

func (*NullLogger) Log

func (s *NullLogger) Log(level Level, args ...interface{})

func (*NullLogger) WithFields

func (s *NullLogger) WithFields(fields Fields) Logger

type RollbarLogger

type RollbarLogger struct {
	*AbstractLogger
	// contains filtered or unexported fields
}

func NewRollbarLogger

func NewRollbarLogger(client *rollbar.Client, level Level) *RollbarLogger

func (*RollbarLogger) Clone

func (s *RollbarLogger) Clone() *RollbarLogger

func (*RollbarLogger) Log

func (s *RollbarLogger) Log(level Level, args ...interface{})

func (*RollbarLogger) WithError

func (s *RollbarLogger) WithError(err error) Logger

func (*RollbarLogger) WithFields

func (s *RollbarLogger) WithFields(fields Fields) Logger

func (*RollbarLogger) WithRequest

func (s *RollbarLogger) WithRequest(req *http.Request) Logger

type SentryLogger

type SentryLogger struct {
	*AbstractLogger
	// contains filtered or unexported fields
}

func NewSentryLogger

func NewSentryLogger(hub *sentry.Hub, level Level) *SentryLogger

func (*SentryLogger) Clone

func (s *SentryLogger) Clone() *SentryLogger

func (*SentryLogger) Log

func (s *SentryLogger) Log(level Level, args ...interface{})

func (*SentryLogger) WithError

func (s *SentryLogger) WithError(err error) Logger

func (*SentryLogger) WithFields

func (s *SentryLogger) WithFields(fields Fields) Logger

func (*SentryLogger) WithRequest

func (s *SentryLogger) WithRequest(req *http.Request) Logger

type StackLogger

type StackLogger struct {
	*AbstractLogger
	// contains filtered or unexported fields
}

func NewStackLogger

func NewStackLogger() *StackLogger

func (*StackLogger) Add

func (s *StackLogger) Add(logger Logger)

func (*StackLogger) Close

func (s *StackLogger) Close()

func (*StackLogger) Log

func (s *StackLogger) Log(level Level, args ...interface{})

func (*StackLogger) WithError

func (s *StackLogger) WithError(err error) Logger

func (*StackLogger) WithField

func (s *StackLogger) WithField(key string, value interface{}) Logger

func (*StackLogger) WithFields

func (s *StackLogger) WithFields(fields Fields) Logger

func (*StackLogger) WithRequest

func (s *StackLogger) WithRequest(req *http.Request) Logger

Jump to

Keyboard shortcuts

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