log

package
v0.0.0-...-953790c Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: MPL-2.0 Imports: 4 Imported by: 0

README

log GoDoc

Package log implements logger for status-go.

Download:

go get github.com/status-im/status-go/geth/log

Package log implements logger for status-go.

This logger handles two loggers - it's own and ethereum-go logger. Both are used as "singletons" - using global shared variables.

Usage

First, import package into your code:

import "github.com/status-im/status-go/geth/log

Then simply use Info/Error/Debug/etc functions to log at desired level:

log.Info("Info message")
log.Debug("Debug message")
log.Error("Error message")

Slightly more complicated logging:

log.Warn("abnormal conn rate", "rate", curRate, "low", lowRate, "high", highRate)

Note, in this case parameters should be in in pairs (key, value).

This logger is based upon log15-logger, so see its documentation for advanced usage: https://github.com/inconshreveable/log15

Initialization

By default logger is set to log to stdout with Error level via init() function. You may change both level and file output by log.SetLevel() and log.SetLogFile() functions:

log.SetLevel("DEBUG")
log.SetLogFile("/path/to/geth.log")

Automatically generated by autoreadme on 2017.09.15

Documentation

Overview

Package log implements logger for status-go.

This logger handles two loggers - it's own and ethereum-go logger. Both are used as "singletons" - using global shared variables.

Usage

First, import package into your code:

import "github.com/status-im/status-go/geth/log

Then simply use `Info/Error/Debug/etc` functions to log at desired level:

log.Info("Info message")
log.Debug("Debug message")
log.Error("Error message")

Slightly more complicated logging:

log.Warn("abnormal conn rate", "rate", curRate, "low", lowRate, "high", highRate)

Note, in this case parameters should be in in pairs (key, value).

This logger is based upon log15-logger, so see its documentation for advanced usage: https://github.com/inconshreveable/log15

Initialization

By default logger is set to log to stdout with Error level via `init()` function. You may change both level and file output by `log.SetLevel()` and `log.SetLogFile()` functions:

log.SetLevel("DEBUG")
log.SetLogFile("/path/to/geth.log")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crit

func Crit(msg string, ctx ...interface{})

Crit is a package scope for logger.Crit

func Debug

func Debug(msg string, ctx ...interface{})

Debug is a package scope for logger.Debug

func Error

func Error(msg string, ctx ...interface{})

Error is a package scope for logger.Error

func Info

func Info(msg string, ctx ...interface{})

Info is a package scope for logger.Info

func SetLevel

func SetLevel(level string)

SetLevel inits status and ethereum-go logging packages, enabling logging and setting up proper log level.

Our log levels are in form "DEBUG|ERROR|WARN|etc", while ethereum-go expects names in lower case: "debug|error|warn|etc".

func SetLogFile

func SetLogFile(filename string) error

SetLogFile configures logger to write output into file. This call preserves current logging level.

func Trace

func Trace(msg string, ctx ...interface{})

Trace is a package scope alias for logger.Trace

func Warn

func Warn(msg string, ctx ...interface{})

Warn is a package scope for logger.Warn

Types

type Logger

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

Logger is a wrapper around log.Logger.

Jump to

Keyboard shortcuts

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