로그 추가
This commit is contained in:
@ -282,19 +282,23 @@ func (caller apiCaller) whitelistAPI(w http.ResponseWriter, r *http.Request) err
|
|||||||
func (caller apiCaller) serviceAPI(w http.ResponseWriter, r *http.Request) error {
|
func (caller apiCaller) serviceAPI(w http.ResponseWriter, r *http.Request) error {
|
||||||
mg := caller.mg
|
mg := caller.mg
|
||||||
if r.Method == "GET" {
|
if r.Method == "GET" {
|
||||||
|
logger.Println("serviceAPI :", r.URL.Path)
|
||||||
if mg.service().Id.IsZero() {
|
if mg.service().Id.IsZero() {
|
||||||
|
logger.Println(" id is zero")
|
||||||
newService := serviceDescription{
|
newService := serviceDescription{
|
||||||
ServiceDescriptionSummary: ServiceDescriptionSummary{
|
ServiceDescriptionSummary: ServiceDescriptionSummary{
|
||||||
Id: primitive.NewObjectID(),
|
Id: primitive.NewObjectID(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if err := newService.prepare(caller.mg); err != nil {
|
if err := newService.prepare(caller.mg); err != nil {
|
||||||
|
logger.Println(" prepare failed :", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
atomic.StorePointer(&mg.serviceptr, unsafe.Pointer(&newService))
|
atomic.StorePointer(&mg.serviceptr, unsafe.Pointer(&newService))
|
||||||
}
|
}
|
||||||
|
|
||||||
serptr := atomic.LoadPointer(&mg.service().serviceSerialized)
|
serptr := atomic.LoadPointer(&mg.service().serviceSerialized)
|
||||||
|
logger.Println(" loadPointer :", string(*(*[]byte)(serptr)))
|
||||||
w.Write(*(*[]byte)(serptr))
|
w.Write(*(*[]byte)(serptr))
|
||||||
} else if r.Method == "POST" {
|
} else if r.Method == "POST" {
|
||||||
body, _ := io.ReadAll(r.Body)
|
body, _ := io.ReadAll(r.Body)
|
||||||
|
|||||||
Reference in New Issue
Block a user