namesys: degrade most logging to debug level
License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>
Lars Gierth committed
Nov 26, 2017 at 03:17 UTC
5d6b3c5701fda113d9ce577a28e262f76fca7757
4 files changed
+9
-10
namesys/base.go
+1
-2
@@ -18,10 +18,9 @@ func resolve(ctx context.Context, r resolver, name string, depth int, prefixes .
18
for {
19
p, err := r.resolveOnce(ctx, name)
20
if err != nil {
21
- log.Warningf("Could not resolve %s", name)
21
return "", err
22
}
24
- log.Debugf("Resolved %s to %s", name, p.String())
23
+ log.Debugf("resolved %s to %s", name, p.String())
24
25
if strings.HasPrefix(p.String(), "/ipfs/") {
26
// we've bottomed out with an IPFS path
namesys/dns.go
+1
-1
@@ -55,7 +55,7 @@ func (r *DNSResolver) resolveOnce(ctx context.Context, name string) (path.Path,
55
if !isd.IsDomain(domain) {
56
return "", errors.New("not a valid domain name")
57
}
58
- log.Infof("DNSResolver resolving %s", domain)
58
+ log.Debugf("DNSResolver resolving %s", domain)
59
60
rootChan := make(chan lookupRes, 1)
61
go workDomain(r, domain, rootChan)
namesys/namesys.go
+2
-2
@@ -91,7 +91,7 @@ func (ns *mpns) resolveOnce(ctx context.Context, name string) (path.Path, error)
91
}
92
segments := strings.SplitN(name, "/", 4)
93
if len(segments) < 3 || segments[0] != "" {
94
- log.Warningf("Invalid name syntax for %s", name)
94
+ log.Debugf("invalid name syntax for %s", name)
95
return "", ErrResolveFailed
96
}
97
@@ -153,7 +153,7 @@ func (ns *mpns) resolveOnce(ctx context.Context, name string) (path.Path, error)
153
return "", ErrResolveFailed
154
}
155
156
- log.Warningf("No resolver found for %s", name)
156
+ log.Debugf("no resolver found for %s", name)
157
return "", ErrResolveFailed
158
}
159
namesys/routing.go
+5
-5
@@ -117,7 +117,7 @@ func (r *routingResolver) ResolveN(ctx context.Context, name string, depth int)
117
// resolveOnce implements resolver. Uses the IPFS routing system to
118
// resolve SFS-like names.
119
func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Path, error) {
120
- log.Debugf("RoutingResolve: '%s'", name)
120
+ log.Debugf("RoutingResolver resolving %s", name)
121
cached, ok := r.cacheGet(name)
122
if ok {
123
return cached, nil
@@ -127,7 +127,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
127
hash, err := mh.FromB58String(name)
128
if err != nil {
129
// name should be a multihash. if it isn't, error out here.
130
- log.Warningf("RoutingResolve: bad input hash: [%s]\n", name)
130
+ log.Debugf("RoutingResolver: bad input hash: [%s]\n", name)
131
return "", err
132
}
133
@@ -143,7 +143,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
143
ipnsKey := string(h)
144
val, err := r.routing.GetValue(ctx, ipnsKey)
145
if err != nil {
146
- log.Warning("RoutingResolve get failed.")
146
+ log.Debugf("RoutingResolver: dht get failed: %s", err)
147
resp <- err
148
return
149
}
@@ -179,7 +179,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
179
180
// check sig with pk
181
if ok, err := pubkey.Verify(ipnsEntryDataForSig(entry), entry.GetSignature()); err != nil || !ok {
182
- return "", fmt.Errorf("Invalid value. Not signed by PrivateKey corresponding to %v", pubkey)
182
+ return "", fmt.Errorf("ipns entry for %s has invalid signature", h)
183
}
184
185
// ok sig checks out. this is a valid name.
@@ -197,7 +197,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
197
return p, nil
198
} else {
199
// Its an old style multihash record
200
- log.Warning("Detected old style multihash record")
200
+ log.Debugf("encountered CIDv0 ipns entry: %s", h)
201
p := path.FromCid(cid.NewCidV0(valh))
202
r.cacheSet(name, p, entry)
203
return p, nil