로거 되돌림

This commit is contained in:
2023-06-14 00:13:51 +09:00
parent 20b2df1fc5
commit 3add5d9355
10 changed files with 60 additions and 87 deletions

View File

@ -18,6 +18,7 @@ import (
"syscall"
"time"
"repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/shared"
"repositories.action2quare.com/ayo/houston/shared/protos"
)
@ -54,7 +55,7 @@ func (hc *houstonClient) uploadZipLogFile(zipFile string, name string, version s
req, err := http.NewRequest("POST", hc.httpAddr+"/upload", zf)
if err != nil {
shared.Logger().Println(err)
logger.Println(err)
}
req.Header.Set("Houston-Service-Name", name)
req.Header.Set("Houston-Service-Version", version)
@ -119,19 +120,19 @@ func zipLogFiles(req *shared.UploadRequest, start, except string) (string, []str
relative := file[len(root)+1:]
fw, err := w.Create(relative)
if err != nil {
shared.Logger().Println(err)
logger.Println(err)
return "", nil, err
}
src, err := os.Open(file)
if err != nil {
shared.Logger().Println(err)
logger.Println(err)
return "", nil, err
}
defer src.Close()
if _, err = io.Copy(fw, src); err != nil {
shared.Logger().Println(err)
logger.Println(err)
return "", nil, err
}
}
@ -218,7 +219,7 @@ func (hc *houstonClient) launch(meta *procmeta) error {
defer func() {
r := recover()
if r != nil {
shared.Logger().Println(r)
logger.Println(r)
debug.PrintStack()
}
close(relayChan)
@ -264,10 +265,10 @@ func (hc *houstonClient) launch(meta *procmeta) error {
os.Remove(oldf)
}
} else {
shared.Logger().Println("uploadZipLogFile failed :", err)
logger.Println("uploadZipLogFile failed :", err)
}
} else if err != nil {
shared.Logger().Println("zipLogFiles failed :", err)
logger.Println("zipLogFiles failed :", err)
}
}(startFile, nextFile)
@ -323,7 +324,7 @@ func (hc *houstonClient) launch(meta *procmeta) error {
var errPrepareprocessLaunchFailed = errors.New("prepareProcessLaunch failed")
func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) error {
shared.Logger().Println("startChildProcess :", *req)
logger.Println("startChildProcess :", *req)
if req.Version == "latest" {
// 최신 버전을 찾음
latest, err := shared.FindLastestVersion(req.Name)
@ -501,10 +502,10 @@ func (hc *houstonClient) uploadFiles(req *shared.UploadRequest) error {
req.Version = latest
}
shared.Logger().Println("uploadFiles req :", *req)
logger.Println("uploadFiles req :", *req)
for _, child := range hc.childProcs {
if child.version == req.Version && child.name == req.Name {
shared.Logger().Println("uploadFiles found :", child.version, child.name)
logger.Println("uploadFiles found :", child.version, child.name)
child.logUploadChan <- req
return nil
}
@ -519,10 +520,10 @@ func (hc *houstonClient) uploadFiles(req *shared.UploadRequest) error {
os.Remove(oldf)
}
} else {
shared.Logger().Println("uploadZipLogFile failed :", err)
logger.Println("uploadZipLogFile failed :", err)
}
} else if err != nil {
shared.Logger().Println("zipLogFiles failed :", err)
logger.Println("zipLogFiles failed :", err)
}
return nil