Skip to content

newmetric/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

newmetric/logger

An implementation that connects multiple logger implementations with a common interface

Logger common interface

type Logger interface {
	// SetLevel sets the logger level
	SetLevel(level Level) error

	// GetLevel returns the current logger level
	GetLevel() Level

	// ReplaceOutputWriter replaces the output writer of the current logger
	ReplaceOutputWriter(w io.Writer)

	// With returns a new Logger with keyvals prepended to those passed to calls to
	With(args ...interface{}) Logger

	// Debug prints debug log
	Debug(msg string, args ...interface{})

	// Info prints info log
	Info(msg string, args ...interface{})

	// Warn prints warn log
	Warn(msg string, args ...interface{})

	// Error prints error log
	Error(msg string, args ...interface{})

	// Fatal prints fatal log
	Fatal(msg string, args ...interface{})

	// Trace prints trace log
	Trace(msg string, args ...interface{})
}

Logger extension

type DisableStackTraceOption interface {
	DisableStackTrace()
}

type FormatLogger interface {
	types.Logger

	// sort by log level
	Debugf(format string, args ...any)
	Infof(format string, args ...any)
	Warnf(format string, args ...any)
	Errorf(format string, args ...any)
	Fatalf(format string, args ...any)
	Tracef(format string, args ...any)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages