diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-22 20:10:07 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-02-23 18:16:44 +0800 |
commit | d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851 (patch) | |
tree | 17c93170551d3eeabe2935de1765f157007f0dc2 /swarm/api/api.go | |
parent | 47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff) | |
download | dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.bz2 dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.lz dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.xz dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip |
all: blidly swap out glog to our log15, logs need rework
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..3376fb484 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", err)) 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 } |