diff options
Diffstat (limited to 'swarm/api/api.go')
-rw-r--r-- | swarm/api/api.go | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/swarm/api/api.go b/swarm/api/api.go index f92a14653..7af27208d 100644 --- a/swarm/api/api.go +++ b/swarm/api/api.go @@ -25,8 +25,7 @@ import ( "sync" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/swarm/storage" ) @@ -72,9 +71,9 @@ type ErrResolve error // DNS Resolver func (self *Api) Resolve(hostPort string, nameresolver bool) (storage.Key, error) { - glog.V(logger.Detail).Infof("Resolving : %v", hostPort) + log.Trace(fmt.Sprintf("Resolving : %v", hostPort)) if hashMatcher.MatchString(hostPort) || self.dns == nil { - glog.V(logger.Detail).Infof("host is a contentHash: '%v'", hostPort) + log.Trace(fmt.Sprintf("host is a contentHash: '%v'", hostPort)) return storage.Key(common.Hex2Bytes(hostPort)), nil } if !nameresolver { @@ -83,9 +82,9 @@ func (self *Api) Resolve(hostPort string, nameresolver bool) (storage.Key, error contentHash, err := self.dns.Resolve(hostPort) if err != nil { err = ErrResolve(err) - glog.V(logger.Warn).Infof("DNS error : %v", err) + log.Warn(fmt.Sprintf("DNS error : %v", err)) } - glog.V(logger.Detail).Infof("host lookup: %v -> %v", err) + log.Trace(fmt.Sprintf("host lookup: %v -> %v", hostPort, contentHash)) return contentHash[:], err } func Parse(uri string) (hostPort, path string) { @@ -110,7 +109,7 @@ func Parse(uri string) (hostPort, path string) { path = parts[i] } } - glog.V(logger.Debug).Infof("host: '%s', path '%s' requested.", hostPort, path) + log.Debug(fmt.Sprintf("host: '%s', path '%s' requested.", hostPort, path)) return } @@ -118,7 +117,7 @@ func (self *Api) parseAndResolve(uri string, nameresolver bool) (key storage.Key hostPort, path = Parse(uri) //resolving host and port contentHash, err := self.Resolve(hostPort, nameresolver) - glog.V(logger.Debug).Infof("Resolved '%s' to contentHash: '%s', path: '%s'", uri, contentHash, path) + log.Debug(fmt.Sprintf("Resolved '%s' to contentHash: '%s', path: '%s'", uri, contentHash, path)) return contentHash[:], hostPort, path, err } @@ -152,11 +151,11 @@ func (self *Api) Get(uri string, nameresolver bool) (reader storage.LazySectionR quitC := make(chan bool) trie, err := loadManifest(self.dpa, key, quitC) if err != nil { - glog.V(logger.Warn).Infof("loadManifestTrie error: %v", err) + log.Warn(fmt.Sprintf("loadManifestTrie error: %v", err)) return } - glog.V(logger.Detail).Infof("getEntry(%s)", path) + log.Trace(fmt.Sprintf("getEntry(%s)", path)) entry, _ := trie.getEntry(path) @@ -164,12 +163,12 @@ func (self *Api) Get(uri string, nameresolver bool) (reader storage.LazySectionR key = common.Hex2Bytes(entry.Hash) status = entry.Status mimeType = entry.ContentType - glog.V(logger.Detail).Infof("content lookup key: '%v' (%v)", key, mimeType) + log.Trace(fmt.Sprintf("content lookup key: '%v' (%v)", key, mimeType)) reader = self.dpa.Retrieve(key) } else { status = http.StatusNotFound err = fmt.Errorf("manifest entry for '%s' not found", path) - glog.V(logger.Warn).Infof("%v", err) + log.Warn(fmt.Sprintf("%v", err)) } return } |