libf 1 년 전
부모
커밋
e3f4fe059f
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      odbclient/client.go

+ 6 - 1
odbclient/client.go

@@ -2,6 +2,7 @@ package odbclient
 
 import (
 	"context"
+	"encoding/json"
 	"fmt"
 	"runtime"
 	"strings"
@@ -11,6 +12,7 @@ import (
 	"git.wecise.com/wecise/odb-go/odb"
 	"git.wecise.com/wecise/odb-go/odb/eventmsg"
 	"github.com/scylladb/go-set/strset"
+	"gopkg.in/yaml.v3"
 )
 
 var cfg = ccfg.MConfig()
@@ -70,7 +72,10 @@ func Subscribe(client odb.Client, topic string) {
 			if err != nil {
 				log.Error(err)
 			}
-			log.Info(topic + " received " + m.Payload + "\n" + oem.YamlString())
+			mm := map[string]interface{}{}
+			json.Unmarshal([]byte(oem.JsonString()), &mm)
+			bs, _ := yaml.Marshal(map[string]interface{}{"oem": mm})
+			log.Info(topic + " received " + m.Payload + "\n" + string(bs))
 		}
 	}()
 }