libf 1 vuosi sitten
vanhempi
commit
e3f4fe059f
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  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))
 		}
 	}()
 }