Commit faaaa229 authored by Jeromy's avatar Jeromy

Merge branch 'ipns' of github.com:jbenet/go-ipfs into ipns

parents 25b36d10 ee1d1ac0
......@@ -7,14 +7,13 @@ import (
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
blocks "github.com/jbenet/go-ipfs/blocks"
exchange "github.com/jbenet/go-ipfs/exchange"
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("blockservice")
var log = u.Logger("blockservice")
// BlockService is a block datastore.
// It uses an internal `datastore.Datastore` instance to store values.
......
......@@ -9,7 +9,6 @@ import (
flag "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
commander "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
config "github.com/jbenet/go-ipfs/config"
core "github.com/jbenet/go-ipfs/core"
......@@ -62,7 +61,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")
func init() {
config, err := config.PathRoot()
......
......@@ -36,7 +36,7 @@ func Add(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Wr
}
// Add the file
nd, err := AddPath(n, path, depth)
_, err = AddPath(n, path, depth)
if err != nil {
if err == ErrDepthLimitExceeded && depth == 1 {
err = errors.New("use -r to recursively add directories")
......@@ -45,12 +45,13 @@ func Add(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Wr
}
// get the key to print it
k, err := nd.Key()
if err != nil {
return fmt.Errorf("addFile error: %v", err)
}
fmt.Fprintf(out, "added %s %s\n", k.Pretty(), path)
// k, err := nd.Key()
// if err != nil {
// return fmt.Errorf("addFile error: %v", err)
// }
//
// Commenting out of here, because it's already in addNode below.
// fmt.Fprintf(out, "added %s %s\n", k.Pretty(), path)
}
return nil
}
......
......@@ -4,10 +4,9 @@ import (
"io"
"github.com/jbenet/go-ipfs/core"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("commands")
var log = u.Logger("commands")
type CmdFunc func(*core.IpfsNode, []string, map[string]interface{}, io.Writer) error
......@@ -9,7 +9,6 @@ import (
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
bserv "github.com/jbenet/go-ipfs/blockservice"
config "github.com/jbenet/go-ipfs/config"
......@@ -28,7 +27,7 @@ import (
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("core")
var log = u.Logger("core")
// IpfsNode is IPFS Core module. It represents an IPFS instance.
type IpfsNode struct {
......
......@@ -9,7 +9,6 @@ import (
"path"
"sync"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
core "github.com/jbenet/go-ipfs/core"
"github.com/jbenet/go-ipfs/core/commands"
u "github.com/jbenet/go-ipfs/util"
......@@ -18,7 +17,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")
// LockFile is the filename of the daemon lock, relative to config dir
const LockFile = "daemon.lock"
......
......@@ -10,7 +10,6 @@ import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/bazil.org/fuse"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/bazil.org/fuse/fs"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
"github.com/jbenet/go-ipfs/core"
ci "github.com/jbenet/go-ipfs/crypto"
......@@ -19,7 +18,7 @@ import (
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("ipns")
var log = u.Logger("ipns")
// FileSystem is the readwrite IPNS Fuse Filesystem.
type FileSystem struct {
......
......@@ -21,10 +21,9 @@ import (
core "github.com/jbenet/go-ipfs/core"
mdag "github.com/jbenet/go-ipfs/merkledag"
u "github.com/jbenet/go-ipfs/util"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
)
var log = logging.MustGetLogger("ipfs")
var log = u.Logger("ipfs")
// FileSystem is the readonly Ipfs Fuse Filesystem.
type FileSystem struct {
......
......@@ -4,7 +4,6 @@ import (
"fmt"
proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
blocks "github.com/jbenet/go-ipfs/blocks"
......@@ -12,7 +11,7 @@ import (
u "github.com/jbenet/go-ipfs/util"
)
var log = logging.MustGetLogger("merkledag")
var log = u.Logger("merkledag")
// NodeMap maps u.Keys to Nodes.
// We cannot use []byte/Multihash for keys :(
......
......@@ -6,15 +6,14 @@ import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto"
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
ci "github.com/jbenet/go-ipfs/crypto"
mdag "github.com/jbenet/go-ipfs/merkledag"
"github.com/jbenet/go-ipfs/routing"
u "github.com/jbenet/go-ipfs/util"
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
)
var log = logging.MustGetLogger("namesys")
var log = u.Logger("namesys")
// RoutingResolver implements NSResolver for the main IPFS SFS-like naming
type RoutingResolver struct {
......
......@@ -8,10 +8,9 @@ import (
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
merkledag "github.com/jbenet/go-ipfs/merkledag"
u "github.com/jbenet/go-ipfs/util"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
)
var log = logging.MustGetLogger("path")
var log = u.Logger("path")
// Resolver provides path resolution to IPFS
// It has a pointer to a DAGService, which is uses to resolve nodes.
......
......@@ -17,12 +17,11 @@ import (
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/datastore.go"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto"
)
var log = logging.MustGetLogger("dht")
var log = u.Logger("dht")
// TODO. SEE https://github.com/jbenet/node-ipfs/blob/master/submodules/ipfs-dht/index.js
......
......@@ -107,6 +107,8 @@ func DOut(format string, a ...interface{}) {
}
}
var loggers = []string{}
// SetupLogging will initialize the logger backend and set the flags.
func SetupLogging() {
backend := logging.NewLogBackend(os.Stderr, "", 0)
......@@ -118,9 +120,19 @@ func SetupLogging() {
logging.SetLevel(logging.ERROR, "")
}
*/
logging.SetLevel(logging.ERROR, "merkledag")
logging.SetLevel(logging.ERROR, "blockservice")
logging.SetFormatter(logging.MustStringFormatter(LogFormat))
for _, n := range loggers {
logging.SetLevel(logging.ERROR, n)
}
}
// Logger retrieves a particular logger + initializes it at a particular level
func Logger(name string) *logging.Logger {
log := logging.MustGetLogger(name)
// logging.SetLevel(lvl, name) // can't set level here.
loggers = append(loggers, name)
return log
}
// ExpandPathnames takes a set of paths and turns them into absolute paths
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment