Documentation ¶
Overview ¶
Package log contains adapter for third-party loggers
Example:
package main
import ( "github.com/insolar/insolar/configuration" "github.com/insolar/insolar/log" ) func main() { // global logger log.SetLevel("Debug") log.Debugln("debug log message") // local logger logger, _ := log.NewLog(configuration.Log{Level: "Warning", Adapter: "zerolog"}) logger.Warnln("warning log message") }
Index ¶
- Variables
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func InternalLevelToZerologLevel(level insolar.LogLevel) (zerolog.Level, error)
- func NewLog(cfg configuration.Log) (insolar.Logger, error)
- func NewLoglevelChangeHandler() http.Handler
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func SetGlobalLogger(logger insolar.Logger)
- func SetLevel(level string) error
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type WatermillLogAdapter
- func (w *WatermillLogAdapter) Debug(msg string, fields watermill.LogFields)
- func (w *WatermillLogAdapter) Error(msg string, err error, fields watermill.LogFields)
- func (w *WatermillLogAdapter) Info(msg string, fields watermill.LogFields)
- func (w *WatermillLogAdapter) Trace(msg string, fields watermill.LogFields)
- func (w *WatermillLogAdapter) With(fields watermill.LogFields) watermill.LoggerAdapter
Constants ¶
This section is empty.
Variables ¶
var FuncFieldName = "func"
FuncFieldName is the field name used for func field.
var GlobalLogger = func() insolar.Logger { holder := configuration.NewHolder().MustInit(false) logger, err := NewLog(holder.Configuration.Log) if err != nil { stdlog.Println("warning:", err.Error()) } if logger == nil { panic("couldn't initialize global logger with default config") } return logger.WithCaller(true).WithSkipFrameCount(1).WithField("loginstance", "global_default") }()
GlobalLogger creates global logger with correct skipCallNumber TODO: make it private again
Functions ¶
func Debug ¶
func Debug(args ...interface{})
Debug logs a message at level Debug to the global logger.
func Debugf ¶ added in v0.2.0
func Debugf(format string, args ...interface{})
Debugf logs a message at level Debug to the global logger.
func Error ¶
func Error(args ...interface{})
Error logs a message at level Error to the global logger.
func Errorf ¶ added in v0.2.0
func Errorf(format string, args ...interface{})
Errorf logs a message at level Error to the global logger.
func Fatal ¶ added in v0.2.0
func Fatal(args ...interface{})
Fatal logs a message at level Fatal to the global logger.
func Fatalf ¶ added in v0.2.0
func Fatalf(format string, args ...interface{})
Fatalf logs a message at level Fatal to the global logger.
func Infof ¶ added in v0.2.0
func Infof(format string, args ...interface{})
Infof logs a message at level Info to the global logger.
func InternalLevelToZerologLevel ¶ added in v0.9.0
func NewLog ¶
func NewLog(cfg configuration.Log) (insolar.Logger, error)
NewLog creates logger instance with particular configuration
func NewLoglevelChangeHandler ¶ added in v0.9.0
func Panic ¶
func Panic(args ...interface{})
Panic logs a message at level Panic to the global logger.
func Panicf ¶ added in v0.2.0
func Panicf(format string, args ...interface{})
Panicf logs a message at level Panic to the global logger.
func SetGlobalLogger ¶ added in v0.7.5
Types ¶
type WatermillLogAdapter ¶ added in v0.9.0
type WatermillLogAdapter struct {
// contains filtered or unexported fields
}
func NewWatermillLogAdapter ¶ added in v0.9.0
func NewWatermillLogAdapter(log insolar.Logger) *WatermillLogAdapter
func (*WatermillLogAdapter) Debug ¶ added in v0.9.0
func (w *WatermillLogAdapter) Debug(msg string, fields watermill.LogFields)
func (*WatermillLogAdapter) Error ¶ added in v0.9.0
func (w *WatermillLogAdapter) Error(msg string, err error, fields watermill.LogFields)
func (*WatermillLogAdapter) Info ¶ added in v0.9.0
func (w *WatermillLogAdapter) Info(msg string, fields watermill.LogFields)
func (*WatermillLogAdapter) Trace ¶ added in v0.9.0
func (w *WatermillLogAdapter) Trace(msg string, fields watermill.LogFields)
func (*WatermillLogAdapter) With ¶ added in v0.9.0
func (w *WatermillLogAdapter) With(fields watermill.LogFields) watermill.LoggerAdapter