log

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

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: "logrus"})
	logger.Warnln("warning log message")
}

Index

Constants

This section is empty.

Variables

View Source
var GlobalLogger = func() core.Logger {
	holder := configuration.NewHolder().MustInit(false)
	logger, err := NewLog(holder.Configuration.Log)
	if err != nil {
		stdlog.Println("warning:", err.Error())
	}

	if err := logger.SetLevel(holder.Configuration.Log.Level); err != nil {
		stdlog.Println("warning:", err.Error())
	}
	return logger
}()

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 Info

func Info(args ...interface{})

Info logs a message at level Info 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 NewLog

func NewLog(cfg configuration.Log) (core.Logger, error)

NewLog creates logger instance with particular configuration

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

func SetGlobalLogger(logger core.Logger)

func SetLevel

func SetLevel(level string) error

SetLevel lets log level for global logger

func SetOutput added in v0.3.0

func SetOutput(w io.Writer)

SetOutput sets the output destination for the logger.

func Warn

func Warn(args ...interface{})

Warn logs a message at level Warn to the global logger.

func Warnf added in v0.2.0

func Warnf(format string, args ...interface{})

Warnf logs a message at level Warn to the global logger.

func WithSkipDelta added in v0.6.3

func WithSkipDelta(cl core.Logger, delta int) core.Logger

WithSkipDelta changes current skip stack frames value for underlying logrus adapter on delta value. More about skip value is here https://golang.org/pkg/runtime/#Caller.

This is useful than logger methods called not from place they should report, like helper functions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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