From 6ecf5e15ceda5e8535727d16a3d04e35cb7f51d0 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 22 Dec 2014 04:33:09 -0800 Subject: clean up logger usage Signed-off-by: FUJITA Tomonori --- api/rest.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'api/rest.go') 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 } -- cgit v1.2.3