파일에 직접 로깅하는 로거로 교체

This commit is contained in:
2023-06-13 20:03:10 +09:00
parent d490188bd2
commit c1847ee3e1
12 changed files with 116 additions and 77 deletions

View File

@ -10,7 +10,7 @@ import (
"runtime/debug"
"strings"
"repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/shared"
)
const (
@ -57,7 +57,7 @@ func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string
return err
}
logger.Printf("houstonHandler registed. deployPath : %s, downloadPath : %s", h.deployPath, h.downloadPath)
shared.Logger().Printf("houstonHandler registed. deployPath : %s, downloadPath : %s", h.deployPath, h.downloadPath)
if len(prefix) > 0 {
prefix = "/" + prefix
@ -74,7 +74,7 @@ func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string
defer func() {
s := recover()
if s != nil {
logger.Println(s)
shared.Logger().Println(s)
debug.PrintStack()
}
io.Copy(io.Discard, r.Body)
@ -107,7 +107,7 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer func() {
s := recover()
if s != nil {
logger.Println(s)
shared.Logger().Println(s)
debug.PrintStack()
}
}()
@ -132,7 +132,7 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
method, ok := h.methods[strings.ToLower(operation)]
if !ok {
// 없는 operation
logger.Println("fail to call api. operation is not valid :", operation)
shared.Logger().Println("fail to call api. operation is not valid :", operation)
w.WriteHeader(http.StatusBadRequest)
return
}