Skip to content

ipfs/go-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2f9b338 · May 4, 2020
Mar 24, 2020
May 4, 2020
Feb 18, 2019
Mar 22, 2016
Nov 21, 2019
Apr 14, 2020
Apr 14, 2020
Sep 4, 2019
May 4, 2020
Mar 24, 2020
Feb 18, 2019
Mar 24, 2020
Mar 24, 2020
Apr 3, 2020

Repository files navigation

go-log

standard-readme compliant GoDoc Build Status

The logging library used by go-ipfs

go-log wraps zap to provide a logging facade. go-log manages logging instances and allows for their levels to be controlled individually.

Install

go get github.com/ipfs/go-log

Usage

Once the package is imported under the name logging, an instance of EventLogger can be created like so:

var log = logging.Logger("subsystem name")

It can then be used to emit log messages in plain printf-style messages at seven standard levels:

Levels may be set for all loggers:

lvl, err := logging.LevelFromString("error")
  if err != nil {
    panic(err)
  }
logging.SetAllLoggers(lvl)

or individually:

lvl, err := logging.LevelFromString("error")
  if err != nil {
    panic(err)
  }
logging.SetLogLevel("foo", "info")

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

Want to hack on IPFS?

License

MIT