initialize loggers at ERROR

This commit is contained in:
Juan Batiz-Benet 2014-10-04 03:36:30 -07:00
parent 02de522216
commit 7e1cd59259
12 changed files with 19 additions and 13 deletions

View File

@ -14,7 +14,7 @@ import (
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("blockservice")
var log = u.Logger("blockservice", logging.ERROR)
// BlockService is a block datastore.
// It uses an internal `datastore.Datastore` instance to store values.

View File

@ -62,7 +62,7 @@ Use "ipfs help <command>" for more information about a command.
}
// log is the command logger
var log = logging.MustGetLogger("cmd/ipfs")
var log = u.Logger("cmd/ipfs", logging.ERROR)
func init() {
config, err := config.PathRoot()

View File

@ -4,10 +4,11 @@ import (
"io"
"github.com/jbenet/go-ipfs/core"
u "github.com/jbenet/go-ipfs/util"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
)
var log = logging.MustGetLogger("commands")
var log = u.Logger("commands", logging.ERROR)
type CmdFunc func(*core.IpfsNode, []string, map[string]interface{}, io.Writer) error

View File

@ -28,7 +28,7 @@ import (
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("core")
var log = u.Logger("core", logging.ERROR)
// IpfsNode is IPFS Core module. It represents an IPFS instance.
type IpfsNode struct {

View File

@ -18,7 +18,7 @@ import (
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
)
var log = logging.MustGetLogger("daemon")
var log = u.Logger("daemon", logging.ERROR)
// LockFile is the filename of the daemon lock, relative to config dir
const LockFile = "daemon.lock"

View File

@ -20,7 +20,7 @@ import (
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("ipns")
var log = u.Logger("ipns", logging.ERROR)
// FileSystem is the readwrite IPNS Fuse Filesystem.
type FileSystem struct {

View File

@ -24,7 +24,7 @@ import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
)
var log = logging.MustGetLogger("ipfs")
var log = u.Logger("ipfs", logging.ERROR)
// FileSystem is the readonly Ipfs Fuse Filesystem.
type FileSystem struct {

View File

@ -12,7 +12,7 @@ import (
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("merkledag")
var log = u.Logger("merkledag", logging.ERROR)
// NodeMap maps u.Keys to Nodes.
// We cannot use []byte/Multihash for keys :(

View File

@ -14,7 +14,7 @@ import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
)
var log = logging.MustGetLogger("namesys")
var log = u.Logger("namesys", logging.ERROR)
// RoutingResolver implements NSResolver for the main IPFS SFS-like naming
type RoutingResolver struct {

View File

@ -11,7 +11,7 @@ import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
)
var log = logging.MustGetLogger("path")
var log = u.Logger("path", logging.ERROR)
// Resolver provides path resolution to IPFS
// It has a pointer to a DAGService, which is uses to resolve nodes.

View File

@ -22,7 +22,7 @@ import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto"
)
var log = logging.MustGetLogger("dht")
var log = u.Logger("dht", logging.ERROR)
// TODO. SEE https://github.com/jbenet/node-ipfs/blob/master/submodules/ipfs-dht/index.js

View File

@ -118,11 +118,16 @@ func SetupLogging() {
logging.SetLevel(logging.ERROR, "")
}
*/
logging.SetLevel(logging.ERROR, "merkledag")
logging.SetLevel(logging.ERROR, "blockservice")
logging.SetFormatter(logging.MustStringFormatter(LogFormat))
}
// Logger retrieves a particular logger + initializes it at a particular level
func Logger(name string, lvl logging.Level) *logging.Logger {
log := logging.MustGetLogger(name)
logging.SetLevel(lvl, name)
return log
}
// ExpandPathnames takes a set of paths and turns them into absolute paths
func ExpandPathnames(paths []string) ([]string, error) {
var out []string