status-go/geth/log
Ivan Daniluk cf7a9949a3 Add some docs/readmes (#329)
Updates and adds some package docs.

It also provides autogenerated README's using https://github.com/jimmyfrasche/autoreadme tool. To use it, make sure it's installed on your system, and every time you update documentation, run go generate to update the README.md file.
2017-09-15 19:00:00 +03:00
..
README.md Add some docs/readmes (#329) 2017-09-15 19:00:00 +03:00
log.go Add some docs/readmes (#329) 2017-09-15 19:00:00 +03:00
log_test.go Add file logger support (#269) 2017-09-02 01:44:50 +07:00

README.md

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