diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-22 04:33:09 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-22 04:33:09 -0800 |
commit | 6ecf5e15ceda5e8535727d16a3d04e35cb7f51d0 (patch) | |
tree | b69464e974cc00cab9dadd5c1b8a6c66e5cf13b1 /api/rest.go | |
parent | d2bbac0697bfdbf6395172163cd0d171bb196246 (diff) |
clean up logger usage
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'api/rest.go')
-rw-r--r-- | api/rest.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/api/rest.go b/api/rest.go index f75b989d..d7339487 100644 --- a/api/rest.go +++ b/api/rest.go @@ -21,17 +21,9 @@ import ( log "github.com/Sirupsen/logrus" "github.com/gorilla/mux" "net/http" - "os" "strconv" ) -var logger *log.Logger = &log.Logger{ - Out: os.Stderr, - Formatter: new(log.JSONFormatter), - Hooks: make(map[log.Level][]log.Hook), - Level: log.InfoLevel, -} - const ( _ = iota REQ_NEIGHBOR @@ -170,11 +162,11 @@ func (rs *RestServer) Neighbor(w http.ResponseWriter, r *http.Request) { remoteAddr, found := params[PARAM_REMOTE_PEER_ADDR] if !found { errStr := "neighbor address is not specified" - logger.Debug(errStr) + log.Debug(errStr) http.Error(w, errStr, http.StatusInternalServerError) } - logger.Debugf("Look up neighbor with the remote address : %v", remoteAddr) + log.Debugf("Look up neighbor with the remote address : %v", remoteAddr) //Send channel of request parameter. req := NewRestRequest(REQ_NEIGHBOR, remoteAddr) @@ -183,7 +175,7 @@ func (rs *RestServer) Neighbor(w http.ResponseWriter, r *http.Request) { //Wait response resInf := <-req.ResponseCh if e := resInf.Err(); e != nil { - logger.Debug(e.Error()) + log.Debug(e.Error()) http.Error(w, e.Error(), http.StatusInternalServerError) return } @@ -200,7 +192,7 @@ func (rs *RestServer) Neighbor(w http.ResponseWriter, r *http.Request) { } if err != nil { errStr := fmt.Sprintf("Failed to perth json of neighbor state", remoteAddr) - logger.Error(errStr) + log.Error(errStr) http.Error(w, errStr, http.StatusInternalServerError) return } |