로그 추가

This commit is contained in:
2023-06-26 23:24:49 +09:00
parent 9590de2e00
commit d17c53c79c
3 changed files with 13 additions and 6 deletions

View File

@ -120,6 +120,7 @@ type houstonClient struct {
func unmarshal[T any](val *T, src map[string]string) { func unmarshal[T any](val *T, src map[string]string) {
argval := reflect.ValueOf(val) argval := reflect.ValueOf(val)
logger.Println("operation receive :", argval.Type().Name(), src)
for i := 0; i < argval.Elem().Type().NumField(); i++ { for i := 0; i < argval.Elem().Type().NumField(); i++ {
if !argval.Elem().Type().Field(i).IsExported() { if !argval.Elem().Type().Field(i).IsExported() {
continue continue

View File

@ -21,7 +21,16 @@ import (
"golang.org/x/text/transform" "golang.org/x/text/transform"
) )
func download(dir string, urlpath string, accessToken string) (string, error) { func download(dir string, urlpath string, accessToken string) (target string, err error) {
logger.Println("start downloading", dir, urlpath)
defer func() {
if err != nil {
logger.Println("downloading failed :", err)
} else {
logger.Println("downloading succeeded")
}
}()
parsed, err := url.Parse(urlpath) parsed, err := url.Parse(urlpath)
if err != nil { if err != nil {
return "", err return "", err
@ -277,7 +286,6 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest) error {
return err return err
} }
logger.Println("start downloading", req.Url)
// verpath에 배포 시작 // verpath에 배포 시작
fname, err := download(root, hc.makeDownloadUrl(req.Url), req.AccessToken) fname, err := download(root, hc.makeDownloadUrl(req.Url), req.AccessToken)
if err != nil { if err != nil {

View File

@ -121,8 +121,10 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var operation string var operation string
if r.Method == "POST" { if r.Method == "POST" {
operation = r.FormValue("operation") operation = r.FormValue("operation")
logger.Println("api called :", r.Form)
} else { } else {
operation = r.URL.Query().Get("operation") operation = r.URL.Query().Get("operation")
logger.Println("api called :", r.URL.Query())
} }
if len(operation) == 0 { if len(operation) == 0 {
@ -138,10 +140,6 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
} }
if r.PostForm == nil {
r.ParseMultipartForm(defaultMaxMemory)
}
args := []reflect.Value{ args := []reflect.Value{
reflect.ValueOf(h), reflect.ValueOf(h),
reflect.ValueOf(w), reflect.ValueOf(w),