@cryptotaxi247 / kubo / commits / 5e72b94a5

Extract thirdparty/loggables License: MIT Signed-off-by: George Antoniadis <george@noodles.gr>

Extract thirdparty/loggables License: MIT Signed-off-by: George Antoniadis <george@noodles.gr>

George Antoniadis committed Sep 10, 2016 at 23:00 UTC 5e72b94a5a657c7f9a2f584fbef5cc7d66c857c1
9 files changed +25 -93
cmd/ipfs/main.go
+1 -1
@@ -32,7 +32,7 @@ import (
32 repo "github.com/ipfs/go-ipfs/repo"
33 config "github.com/ipfs/go-ipfs/repo/config"
34 fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
35 - loggables "github.com/ipfs/go-ipfs/thirdparty/loggables"
35 + loggables "gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
36 )
37
38 // log is the command logger
core/bootstrap.go
+1 -1
@@ -9,8 +9,8 @@ import (
9 "time"
10
11 config "github.com/ipfs/go-ipfs/repo/config"
12 - lgbl "github.com/ipfs/go-ipfs/thirdparty/loggables"
12 math2 "github.com/ipfs/go-ipfs/thirdparty/math2"
13 + lgbl "gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
14
15 goprocess "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess"
16 procctx "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess/context"
exchange/bitswap/bitswap.go
+3 -2
@@ -8,6 +8,8 @@ import (
8 "sync"
9 "time"
10
11 + key "gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
12 +
13 blocks "github.com/ipfs/go-ipfs/blocks"
14 blockstore "github.com/ipfs/go-ipfs/blocks/blockstore"
15 exchange "github.com/ipfs/go-ipfs/exchange"
@@ -18,8 +20,7 @@ import (
20 wantlist "github.com/ipfs/go-ipfs/exchange/bitswap/wantlist"
21 flags "github.com/ipfs/go-ipfs/flags"
22 "github.com/ipfs/go-ipfs/thirdparty/delay"
21 - loggables "github.com/ipfs/go-ipfs/thirdparty/loggables"
22 - key "gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
23 + loggables "gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
24
25 process "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess"
26 procctx "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess/context"
fuse/readonly/readonly_unix.go
+5 -4
@@ -9,17 +9,18 @@ import (
9 "os"
10 "syscall"
11
12 + logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
13 + proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
14 + "gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
15 +
16 fuse "github.com/ipfs/go-ipfs/Godeps/_workspace/src/bazil.org/fuse"
17 fs "github.com/ipfs/go-ipfs/Godeps/_workspace/src/bazil.org/fuse/fs"
18 core "github.com/ipfs/go-ipfs/core"
19 mdag "github.com/ipfs/go-ipfs/merkledag"
20 path "github.com/ipfs/go-ipfs/path"
17 - lgbl "github.com/ipfs/go-ipfs/thirdparty/loggables"
21 uio "github.com/ipfs/go-ipfs/unixfs/io"
22 ftpb "github.com/ipfs/go-ipfs/unixfs/pb"
20 - logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
21 - proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
22 - "gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
23 + lgbl "gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
24 )
25
26 var log = logging.Logger("fuse/ipfs")
package.json
+6
@@ -233,6 +233,12 @@
233 "hash": "QmUHmMGmcwCrjHQHcYhBnqGCSWs5pBSMbGZmfwavETR1gg",
234 "name": "go-ds-leveldb",
235 "version": "1.0.0"
236 + },
237 + {
238 + "author": "whyrusleeping",
239 + "hash": "QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7",
240 + "name": "go-libp2p-loggables",
241 + "version": "1.0.11"
242 }
243 ],
244 "gxVersion": "0.4.0",
routing/dht/handlers.go
+3 -2
@@ -5,11 +5,12 @@ import (
5 "fmt"
6 "time"
7
8 - pb "github.com/ipfs/go-ipfs/routing/dht/pb"
9 - lgbl "github.com/ipfs/go-ipfs/thirdparty/loggables"
8 ds "gx/ipfs/QmbzuUusHqaLLoNTDEVLcSF6vZDHZDLPC7p4bztRvvkXxU/go-datastore"
9 key "gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
10
11 + pb "github.com/ipfs/go-ipfs/routing/dht/pb"
12 + lgbl "gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
13 +
14 pstore "gx/ipfs/QmSZi9ygLohBUGyHMqE5N6eToPwqcg7bZQTULeVLFu7Q6d/go-libp2p-peerstore"
15 peer "gx/ipfs/QmWtbQU15LaB5B1JC2F7TV9P4K88vD3PpA4AJrwfCjhML8/go-libp2p-peer"
16 proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
routing/supernode/client.go
+3 -2
@@ -5,11 +5,12 @@ import (
5 "errors"
6 "time"
7
8 + key "gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
9 +
10 routing "github.com/ipfs/go-ipfs/routing"
11 pb "github.com/ipfs/go-ipfs/routing/dht/pb"
12 proxy "github.com/ipfs/go-ipfs/routing/supernode/proxy"
11 - loggables "github.com/ipfs/go-ipfs/thirdparty/loggables"
12 - key "gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
13 + loggables "gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
14
15 pstore "gx/ipfs/QmSZi9ygLohBUGyHMqE5N6eToPwqcg7bZQTULeVLFu7Q6d/go-libp2p-peerstore"
16 logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
routing/supernode/proxy/standard.go
+3 -2
@@ -12,10 +12,11 @@ import (
12 host "gx/ipfs/Qmf4ETeAWXuThBfWwonVyFqGFSgTWepUDEr1txcctvpTXS/go-libp2p/p2p/host"
13 inet "gx/ipfs/Qmf4ETeAWXuThBfWwonVyFqGFSgTWepUDEr1txcctvpTXS/go-libp2p/p2p/net"
14
15 + key "gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
16 +
17 dhtpb "github.com/ipfs/go-ipfs/routing/dht/pb"
18 kbucket "github.com/ipfs/go-ipfs/routing/kbucket"
17 - loggables "github.com/ipfs/go-ipfs/thirdparty/loggables"
18 - key "gx/ipfs/Qmce4Y4zg3sYr7xKM5UueS67vhNni6EeWgCRnb7MbLJMew/go-key"
19 + loggables "gx/ipfs/QmYrv4LgCC8FhG2Ab4bwuq5DqBdwMtx3hMb3KKJDZcr2d7/go-libp2p-loggables"
20 )
21
22 const ProtocolSNR = "/ipfs/supernoderouting"
thirdparty/loggables/loggables.go deleted
-79
@@ -1,79 +0,0 @@
1 -// Package loggables includes a bunch of translator functions for
2 -// commonplace/stdlib objects. This is boilerplate code that shouldn't change
3 -// much, and not sprinkled all over the place (i.e. gather it here).
4 -//
5 -// NOTE: it may make sense to put all stdlib Loggable functions in the eventlog
6 -// package. Putting it here for now in case we don't want to pollute it.
7 -package loggables
8 -
9 -import (
10 - "net"
11 -
12 - uuid "gx/ipfs/QmcyaFHbyiZfoX5GTpcqqCPYmbjYNAhRDekXSJPFHdYNSV/go.uuid"
13 -
14 - ma "gx/ipfs/QmYzDkkgAEmrcNzFCiYo6L1dTX4EAG1gZkbtdbd9trL4vd/go-multiaddr"
15 -
16 - logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
17 -
18 - peer "gx/ipfs/QmWtbQU15LaB5B1JC2F7TV9P4K88vD3PpA4AJrwfCjhML8/go-libp2p-peer"
19 -)
20 -
21 -// NetConn returns an eventlog.Metadata with the conn addresses
22 -func NetConn(c net.Conn) logging.Loggable {
23 - return logging.Metadata{
24 - "localAddr": c.LocalAddr(),
25 - "remoteAddr": c.RemoteAddr(),
26 - }
27 -}
28 -
29 -// Error returns an eventlog.Metadata with an error
30 -func Error(e error) logging.Loggable {
31 - return logging.Metadata{
32 - "error": e.Error(),
33 - }
34 -}
35 -
36 -func Uuid(key string) logging.Metadata {
37 - return logging.Metadata{
38 - key: uuid.NewV4().String(),
39 - }
40 -}
41 -
42 -// Dial metadata is metadata for dial events
43 -func Dial(sys string, lid, rid peer.ID, laddr, raddr ma.Multiaddr) DeferredMap {
44 - m := DeferredMap{}
45 - m["subsystem"] = sys
46 - if lid != "" {
47 - m["localPeer"] = func() interface{} { return lid.Pretty() }
48 - }
49 - if laddr != nil {
50 - m["localAddr"] = func() interface{} { return laddr.String() }
51 - }
52 - if rid != "" {
53 - m["remotePeer"] = func() interface{} { return rid.Pretty() }
54 - }
55 - if raddr != nil {
56 - m["remoteAddr"] = func() interface{} { return raddr.String() }
57 - }
58 - return m
59 -}
60 -
61 -// DeferredMap is a Loggable which may contain deferred values.
62 -type DeferredMap map[string]interface{}
63 -
64 -// Loggable describes objects that can be marshalled into Metadata for logging
65 -func (m DeferredMap) Loggable() map[string]interface{} {
66 - m2 := map[string]interface{}{}
67 - for k, v := range m {
68 -
69 - if vf, ok := v.(func() interface{}); ok {
70 - // if it's a DeferredVal, call it.
71 - m2[k] = vf()
72 -
73 - } else {
74 - // else use the value as is.
75 - m2[k] = v
76 - }
77 - }
78 - return m2
79 -}