diff options
| author | zhangjie <iamkadisi@163.com> | 2019-08-14 14:48:50 +0800 |
|---|---|---|
| committer | zhangjie <iamkadisi@163.com> | 2019-08-16 19:17:14 +0800 |
| commit | 8f8bc5090288232a707298ea183a2f2b7f460acb (patch) | |
| tree | 5486ca98c12bbd1be04cd92307445aad7c0f3aab /mappers | |
| parent | unifying edgesite component logging library to klog (diff) | |
| download | kubeedge-8f8bc5090288232a707298ea183a2f2b7f460acb.tar.gz | |
unifying emappercomponent logging library to klog
Signed-off-by: zhangjie <iamkadisi@163.com>
Diffstat (limited to 'mappers')
| -rw-r--r-- | mappers/bluetooth_mapper/action_manager/action_manager.go | 20 | ||||
| -rw-r--r-- | mappers/bluetooth_mapper/controller/controller.go | 44 | ||||
| -rw-r--r-- | mappers/bluetooth_mapper/helper/helper.go | 21 | ||||
| -rw-r--r-- | mappers/bluetooth_mapper/main.go | 13 | ||||
| -rw-r--r-- | mappers/bluetooth_mapper/scheduler/scheduler.go | 14 | ||||
| -rw-r--r-- | mappers/bluetooth_mapper/watcher/watcher.go | 32 |
6 files changed, 74 insertions, 70 deletions
diff --git a/mappers/bluetooth_mapper/action_manager/action_manager.go b/mappers/bluetooth_mapper/action_manager/action_manager.go index 4336e19ca..7646ae782 100644 --- a/mappers/bluetooth_mapper/action_manager/action_manager.go +++ b/mappers/bluetooth_mapper/action_manager/action_manager.go @@ -21,8 +21,8 @@ import ( "fmt" "strings" - "github.com/golang/glog" "github.com/paypal/gatt" + "k8s.io/klog" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/data_converter" ) @@ -65,15 +65,15 @@ type ActionManager struct { //PerformOperation executes the operation func (action *Action) PerformOperation(readConverter ...dataconverter.DataRead) { - glog.Infof("Performing operations associated with action: %s", action.Name) + klog.Infof("Performing operations associated with action: %s", action.Name) characteristic, err := FindCharacteristic(action.Operation.CharacteristicUUID) if err != nil { - glog.Errorf("Error in finding characteristics: %s", err) + klog.Errorf("Error in finding characteristics: %s", err) } if strings.ToUpper(action.Operation.Action) == ActionRead { readValue, err := ReadCharacteristic(GattPeripheral, characteristic) if err != nil { - glog.Errorf("Error in reading characteristic: %s", err) + klog.Errorf("Error in reading characteristic: %s", err) return } converted := false @@ -87,18 +87,18 @@ func (action *Action) PerformOperation(readConverter ...dataconverter.DataRead) if !converted { action.Operation.Value = readValue } - glog.Infof("Read Successful") + klog.Info("Read Successful") } else if strings.ToUpper(action.Operation.Action) == ActionWrite { if action.Operation.Value == nil { - glog.Errorf("Please provide a value to be written") + klog.Errorf("Please provide a value to be written") return } err := WriteCharacteristic(GattPeripheral, characteristic, action.Operation.Value) if err != nil { - glog.Errorf("Error in writing characteristic: %s", err) + klog.Errorf("Error in writing characteristic: %s", err) return } - glog.Infof("Write Successful") + klog.Info("Write Successful") } } @@ -116,7 +116,7 @@ func FindCharacteristic(characteristicUUID string) (*gatt.Characteristic, error) func ReadCharacteristic(p gatt.Peripheral, c *gatt.Characteristic) ([]byte, error) { value, err := p.ReadCharacteristic(c) if err != nil { - glog.Errorf("Error in reading characteristic, err: %s\n", err) + klog.Errorf("Error in reading characteristic, err: %s\n", err) return nil, err } return value, nil @@ -126,7 +126,7 @@ func ReadCharacteristic(p gatt.Peripheral, c *gatt.Characteristic) ([]byte, erro func WriteCharacteristic(p gatt.Peripheral, c *gatt.Characteristic, b []byte) error { err := p.WriteCharacteristic(c, b, false) if err != nil { - glog.Errorf("Error in writing characteristic, err: %s\n", err) + klog.Errorf("Error in writing characteristic, err: %s\n", err) return err } return nil diff --git a/mappers/bluetooth_mapper/controller/controller.go b/mappers/bluetooth_mapper/controller/controller.go index 6bbc1238c..c5e749e53 100644 --- a/mappers/bluetooth_mapper/controller/controller.go +++ b/mappers/bluetooth_mapper/controller/controller.go @@ -21,9 +21,9 @@ import ( "strings" MQTT "github.com/eclipse/paho.mqtt.golang" - "github.com/golang/glog" "github.com/paypal/gatt" "github.com/paypal/gatt/examples/option" + "k8s.io/klog" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/action_manager" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/configuration" @@ -72,7 +72,7 @@ func (c *Config) Start() { helper.ControllerWg.Add(1) device, err := gatt.NewDevice(option.DefaultClientOptions...) if err != nil { - glog.Fatalf("Failed to open device, err: %s\n", err) + klog.Fatalf("Failed to open device, err: %s\n", err) return } go c.Watcher.Initiate(device, c.Device.Name, c.Device.ID, c.ActionManager.Actions, c.Converter) @@ -96,7 +96,7 @@ func subscribeAllTopics() { for key, value := range topicMap { helper.TokenClient = helper.Client.Subscribe(key, 0, value) if helper.TokenClient.Wait() && helper.TokenClient.Error() != nil { - glog.Errorf("subscribe() Error in topic: %s is: %s", key, helper.TokenClient.Error()) + klog.Errorf("subscribe() Error in topic: %s is: %s", key, helper.TokenClient.Error()) } } } @@ -106,12 +106,12 @@ func (c *Config) handleWatchMessage(client MQTT.Client, message MQTT.Message) { newWatch := watcher.Watcher{} err := json.Unmarshal(message.Payload(), &newWatch) if err != nil { - glog.Errorf("Error in unmarshalling: %s", err) + klog.Errorf("Error in unmarshalling: %s", err) } c.Watcher = newWatch configuration.Config.Watcher = c.Watcher - glog.Infof("New watcher has been started") - glog.Infof("New Watcher: %v", c.Watcher) + klog.Infof("New watcher has been started") + klog.Infof("New Watcher: %v", c.Watcher) } //handleScheduleCreateMessage is the MQTT handler function for adding schedules at runtime @@ -119,7 +119,7 @@ func (c *Config) handleScheduleCreateMessage(client MQTT.Client, message MQTT.Me newSchedules := []scheduler.Schedule{} err := json.Unmarshal(message.Payload(), &newSchedules) if err != nil { - glog.Errorf("Error in unmarshalling: %s", err) + klog.Errorf("Error in unmarshalling: %s", err) } for _, newSchedule := range newSchedules { scheduleExists := false @@ -132,11 +132,11 @@ func (c *Config) handleScheduleCreateMessage(client MQTT.Client, message MQTT.Me } if scheduleExists { c.Scheduler.Schedules = append(c.Scheduler.Schedules, newSchedule) - glog.Infof("Schedule: %s has been updated", newSchedule.Name) - glog.Infof("Updated Schedule: %v", newSchedule) + klog.Infof("Schedule: %s has been updated", newSchedule.Name) + klog.Infof("Updated Schedule: %v", newSchedule) } else { - glog.Infof("Schedule: %s has been added", newSchedule.Name) - glog.Infof("New Schedule: %v", newSchedule) + klog.Infof("Schedule: %s has been added", newSchedule.Name) + klog.Infof("New Schedule: %v", newSchedule) } configuration.Config.Scheduler = c.Scheduler helper.ControllerWg.Add(1) @@ -149,7 +149,7 @@ func (c *Config) handleScheduleDeleteMessage(client MQTT.Client, message MQTT.Me schedulesToBeDeleted := []scheduler.Schedule{} err := json.Unmarshal(message.Payload(), &schedulesToBeDeleted) if err != nil { - glog.Errorf("Error in unmarshalling: %s", err) + klog.Errorf("Error in unmarshalling: %s", err) } for _, scheduleToBeDeleted := range schedulesToBeDeleted { scheduleExists := false @@ -163,9 +163,9 @@ func (c *Config) handleScheduleDeleteMessage(client MQTT.Client, message MQTT.Me } configuration.Config.Scheduler = c.Scheduler if !scheduleExists { - glog.Errorf("Schedule: %s does not exist", scheduleToBeDeleted.Name) + klog.Errorf("Schedule: %s does not exist", scheduleToBeDeleted.Name) } else { - glog.Infof("Schedule: %s has been deleted ", scheduleToBeDeleted.Name) + klog.Infof("Schedule: %s has been deleted ", scheduleToBeDeleted.Name) } } } @@ -175,7 +175,7 @@ func (c *Config) handleActionCreateMessage(client MQTT.Client, message MQTT.Mess newActions := []actionmanager.Action{} err := json.Unmarshal(message.Payload(), &newActions) if err != nil { - glog.Errorf("Error in unmarshalling: %s", err) + klog.Errorf("Error in unmarshalling: %s", err) } for _, newAction := range newActions { actionExists := false @@ -188,11 +188,11 @@ func (c *Config) handleActionCreateMessage(client MQTT.Client, message MQTT.Mess } if actionExists { c.ActionManager.Actions = append(c.ActionManager.Actions, newAction) - glog.Infof("Action: %s has been updated", newAction.Name) - glog.Infof("Updated Action: %v", newAction) + klog.Infof("Action: %s has been updated", newAction.Name) + klog.Infof("Updated Action: %v", newAction) } else { - glog.Infof("Action: %s has been added ", newAction.Name) - glog.Infof("New Action: %v", newAction) + klog.Infof("Action: %s has been added ", newAction.Name) + klog.Infof("New Action: %v", newAction) } configuration.Config.ActionManager = c.ActionManager if newAction.PerformImmediately { @@ -206,7 +206,7 @@ func (c *Config) handleActionDeleteMessage(client MQTT.Client, message MQTT.Mess actionsToBeDeleted := []actionmanager.Action{} err := json.Unmarshal(message.Payload(), &actionsToBeDeleted) if err != nil { - glog.Errorf("Error in unmarshalling: %s", err) + klog.Errorf("Error in unmarshalling: %s", err) } for _, actionToBeDeleted := range actionsToBeDeleted { actionExists := false @@ -220,9 +220,9 @@ func (c *Config) handleActionDeleteMessage(client MQTT.Client, message MQTT.Mess } configuration.Config.ActionManager = c.ActionManager if !actionExists { - glog.Errorf("Action: %s did not exist", actionToBeDeleted.Name) + klog.Errorf("Action: %s did not exist", actionToBeDeleted.Name) } else { - glog.Infof("Action: %s has been deleted ", actionToBeDeleted.Name) + klog.Infof("Action: %s has been deleted ", actionToBeDeleted.Name) } } } diff --git a/mappers/bluetooth_mapper/helper/helper.go b/mappers/bluetooth_mapper/helper/helper.go index 6ef5ed394..6dfc84399 100644 --- a/mappers/bluetooth_mapper/helper/helper.go +++ b/mappers/bluetooth_mapper/helper/helper.go @@ -22,8 +22,9 @@ import ( "sync" "time" + "k8s.io/klog" + MQTT "github.com/eclipse/paho.mqtt.golang" - "github.com/golang/glog" ) var ( @@ -130,7 +131,7 @@ func MqttConnect(mqttMode int, mqttInternalServer, mqttServer string) { } Client = MQTT.NewClient(ClientOpts) if TokenClient = Client.Connect(); TokenClient.Wait() && TokenClient.Error() != nil { - glog.Errorf("client.Connect() Error is %s", TokenClient.Error()) + klog.Errorf("client.Connect() Error is %s", TokenClient.Error()) } } @@ -138,12 +139,12 @@ func MqttConnect(mqttMode int, mqttInternalServer, mqttServer string) { func ChangeTwinValue(updateMessage DeviceTwinUpdate, deviceID string) { twinUpdateBody, err := json.Marshal(updateMessage) if err != nil { - glog.Errorf("Error in marshalling: %s", err) + klog.Errorf("Error in marshalling: %s", err) } deviceTwinUpdate := DeviceETPrefix + deviceID + TwinETUpdateSuffix TokenClient = Client.Publish(deviceTwinUpdate, 0, false, twinUpdateBody) if TokenClient.Wait() && TokenClient.Error() != nil { - glog.Errorf("client.publish() Error in device twin update is %s", TokenClient.Error()) + klog.Errorf("client.publish() Error in device twin update is %s", TokenClient.Error()) } } @@ -152,11 +153,11 @@ func SyncToCloud(updateMessage DeviceTwinUpdate, deviceID string) { deviceTwinResultUpdate := DeviceETPrefix + deviceID + TwinETCloudSyncSuffix twinUpdateBody, err := json.Marshal(updateMessage) if err != nil { - glog.Errorf("Error in marshalling: %s", err) + klog.Errorf("Error in marshalling: %s", err) } TokenClient = Client.Publish(deviceTwinResultUpdate, 0, false, twinUpdateBody) if TokenClient.Wait() && TokenClient.Error() != nil { - glog.Errorf("client.publish() Error in device twin update is: %s", TokenClient.Error()) + klog.Errorf("client.publish() Error in device twin update is: %s", TokenClient.Error()) } } @@ -165,11 +166,11 @@ func GetTwin(updateMessage DeviceTwinUpdate, deviceID string) { getTwin := DeviceETPrefix + deviceID + TwinETGetSuffix twinUpdateBody, err := json.Marshal(updateMessage) if err != nil { - glog.Errorf("Error in marshalling: %s", err) + klog.Errorf("Error in marshalling: %s", err) } TokenClient = Client.Publish(getTwin, 0, false, twinUpdateBody) if TokenClient.Wait() && TokenClient.Error() != nil { - glog.Errorf("client.publish() Error in device twin get is: %s ", TokenClient.Error()) + klog.Errorf("client.publish() Error in device twin get is: %s ", TokenClient.Error()) } } @@ -178,7 +179,7 @@ func TwinSubscribe(deviceID string) { getTwinResult := DeviceETPrefix + deviceID + TwinETGetResultSuffix TokenClient = Client.Subscribe(getTwinResult, 0, OnTwinMessageReceived) if TokenClient.Wait() && TokenClient.Error() != nil { - glog.Errorf("subscribe() Error in device twin result get is: %s", TokenClient.Error()) + klog.Errorf("subscribe() Error in device twin result get is: %s", TokenClient.Error()) } for { time.Sleep(1 * time.Second) @@ -196,7 +197,7 @@ func TwinSubscribe(deviceID string) { func OnTwinMessageReceived(client MQTT.Client, message MQTT.Message) { err := json.Unmarshal(message.Payload(), &TwinResult) if err != nil { - glog.Errorf("Error in unmarshalling: %s", err) + klog.Errorf("Error in unmarshalling: %s", err) } } diff --git a/mappers/bluetooth_mapper/main.go b/mappers/bluetooth_mapper/main.go index 1c433c61f..faeacf746 100644 --- a/mappers/bluetooth_mapper/main.go +++ b/mappers/bluetooth_mapper/main.go @@ -20,24 +20,27 @@ import ( "flag" "os" - "github.com/golang/glog" + "github.com/spf13/pflag" + "k8s.io/klog" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/configuration" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/controller" ) -//usage is responsible for setting up the default settings of all defined command-line flags for glog. +//usage is responsible for setting up the default settings of all defined command-line flags for log. func usage() { flag.PrintDefaults() os.Exit(2) } -//init for getting command line arguments for glog +//init for getting command line arguments for log func init() { + klog.InitFlags(nil) flag.Usage = usage // NOTE: This next line is key you have to call flag.Parse() for the command line - // options or "flags" that are defined in the glog module to be picked up. + // options or "flags" that are defined in the log module to be picked up. flag.Parse() + pflag.CommandLine.AddGoFlagSet(flag.CommandLine) } // main function @@ -46,7 +49,7 @@ func main() { // load config err := BleConfig.Load() if err != nil { - glog.Errorf("Error in loading configuration: %s", err) + klog.Errorf("Error in loading configuration: %s", err) os.Exit(1) } bleController := controller.Config{ diff --git a/mappers/bluetooth_mapper/scheduler/scheduler.go b/mappers/bluetooth_mapper/scheduler/scheduler.go index 047aff4b8..ae16e2c50 100644 --- a/mappers/bluetooth_mapper/scheduler/scheduler.go +++ b/mappers/bluetooth_mapper/scheduler/scheduler.go @@ -22,7 +22,7 @@ import ( "strings" "time" - "github.com/golang/glog" + "k8s.io/klog" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/action_manager" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/data_converter" @@ -62,7 +62,7 @@ type ScheduleResult struct { // ExecuteSchedule is responsible for scheduling the operations func (schedule *Schedule) ExecuteSchedule(actionManager []actionmanager.Action, dataConverter dataconverter.DataRead, deviceID string) { - glog.Infof("Executing schedule: %s", schedule.Name) + klog.Infof("Executing schedule: %s", schedule.Name) if schedule.OccurrenceLimit != 0 { for iteration := 0; iteration < schedule.OccurrenceLimit; iteration++ { schedule.performScheduleOperation(actionManager, dataConverter, deviceID) @@ -83,7 +83,7 @@ func (schedule *Schedule) performScheduleOperation(actionManager []actionmanager for _, action := range actionManager { if strings.ToUpper(action.Name) == strings.ToUpper(actionName) { actionExists = true - glog.Infof("Performing scheduled operation: %s", action.Name) + klog.Infof("Performing scheduled operation: %s", action.Name) action.PerformOperation(dataConverter) scheduleResult.EventName = actionName scheduleResult.TimeStamp = time.Now().UnixNano() / 1e6 @@ -95,7 +95,7 @@ func (schedule *Schedule) performScheduleOperation(actionManager []actionmanager schedule.Interval = defaultEventFrequency } if !actionExists { - glog.Errorf("Action %s does not exist. Exiting from schedule !!!", actionName) + klog.Errorf("Action %s does not exist. Exiting from schedule !!!", actionName) break } time.Sleep(time.Duration(time.Duration(schedule.Interval) * time.Millisecond)) @@ -105,13 +105,13 @@ func (schedule *Schedule) performScheduleOperation(actionManager []actionmanager //publishScheduleResult publishes the telemetry data on the given MQTT topic func publishScheduleResult(scheduleResult ScheduleResult, deviceID string) { scheduleResultTopic := MapperTopicPrefix + deviceID + SchedulerResultSuffix - glog.Infof("Publishing schedule: %s result on topic: %s", scheduleResult.EventName, scheduleResultTopic) + klog.Infof("Publishing schedule: %s result on topic: %s", scheduleResult.EventName, scheduleResultTopic) scheduleResultBody, err := json.Marshal(scheduleResult) if err != nil { - glog.Errorf("Error: %s", err) + klog.Errorf("Error: %s", err) } helper.TokenClient = helper.Client.Publish(scheduleResultTopic, 0, false, scheduleResultBody) if helper.TokenClient.Wait() && helper.TokenClient.Error() != nil { - glog.Errorf("client.publish() Error in device twin get is %s", helper.TokenClient.Error()) + klog.Errorf("client.publish() Error in device twin get is %s", helper.TokenClient.Error()) } } diff --git a/mappers/bluetooth_mapper/watcher/watcher.go b/mappers/bluetooth_mapper/watcher/watcher.go index 9218b8ac5..57939e17d 100644 --- a/mappers/bluetooth_mapper/watcher/watcher.go +++ b/mappers/bluetooth_mapper/watcher/watcher.go @@ -23,8 +23,8 @@ import ( "strings" "time" - "github.com/golang/glog" "github.com/paypal/gatt" + "k8s.io/klog" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/action_manager" "github.com/kubeedge/kubeedge/mappers/bluetooth_mapper/data_converter" @@ -63,14 +63,14 @@ func (w *Watcher) Initiate(device gatt.Device, nameOfDevice, idOfDevice string, ) device.Init(onStateChanged) <-done - glog.Infof("Watcher Done") + klog.Infof("Watcher Done") } //onStateChanged contains the operations to be performed when the state of the peripheral device changes func onStateChanged(device gatt.Device, s gatt.State) { switch s { case gatt.StatePoweredOn: - glog.Infof("Scanning for BLE device Broadcasts...") + klog.Infof("Scanning for BLE device Broadcasts...") device.Scan([]gatt.UUID{}, true) return default: @@ -81,17 +81,17 @@ func onStateChanged(device gatt.Device, s gatt.State) { //onPeripheralDiscovered contains the operations to be performed as soon as the peripheral device is discovered func onPeripheralDiscovered(p gatt.Peripheral, a *gatt.Advertisement, rssi int) { if strings.ToUpper(a.LocalName) == strings.ToUpper(strings.Replace(deviceName, "-", " ", -1)) { - glog.Infof("Device: %s found !!!! Stop Scanning for devices", deviceName) + klog.Infof("Device: %s found !!!! Stop Scanning for devices", deviceName) // Stop scanning once we've got the peripheral we're looking for. p.Device().StopScanning() - glog.Infof("Connecting to %s", deviceName) + klog.Infof("Connecting to %s", deviceName) p.Device().Connect(p) } } //onPeripheralDisconnected contains the operations to be performed as soon as the peripheral device is disconnected func onPeripheralDisconnected(p gatt.Peripheral, err error) { - glog.Infof("Disconnecting from bluetooth device....") + klog.Infof("Disconnecting from bluetooth device....") DeviceConnected <- false close(done) p.Device().CancelConnection(p) @@ -102,14 +102,14 @@ func (w *Watcher) onPeripheralConnected(p gatt.Peripheral, err error) { actionmanager.GattPeripheral = p ss, err := p.DiscoverServices(nil) if err != nil { - glog.Errorf("Failed to discover services, err: %s\n", err) + klog.Errorf("Failed to discover services, err: %s\n", err) os.Exit(1) } for _, s := range ss { // Discovery characteristics cs, err := p.DiscoverCharacteristics(nil, s) if err != nil { - glog.Errorf("Failed to discover characteristics for service %s, err: %v\n", s.Name(), err) + klog.Errorf("Failed to discover characteristics for service %s, err: %v\n", s.Name(), err) continue } actionmanager.CharacteristicsList = append(actionmanager.CharacteristicsList, cs...) @@ -120,7 +120,7 @@ func (w *Watcher) onPeripheralConnected(p gatt.Peripheral, err error) { if !reflect.DeepEqual(w, newWatcher) { err := w.EquateTwinValue(deviceID) if err != nil { - glog.Errorf("Error in watcher functionality: %s", err) + klog.Errorf("Error in watcher functionality: %s", err) } } } @@ -131,7 +131,7 @@ func (w *Watcher) EquateTwinValue(deviceID string) error { var updateMessage helper.DeviceTwinUpdate updatedActualValues := make(map[string]string) helper.Wg.Add(1) - glog.Infof("Watching on the device twin values for device with deviceID: %s", deviceID) + klog.Infof("Watching on the device twin values for device with deviceID: %s", deviceID) go helper.TwinSubscribe(deviceID) helper.GetTwin(updateMessage, deviceID) helper.Wg.Wait() @@ -139,13 +139,13 @@ func (w *Watcher) EquateTwinValue(deviceID string) error { for _, twinAttribute := range w.DeviceTwinAttributes { if helper.TwinResult.Twin[twinAttribute.Name] != nil { if helper.TwinResult.Twin[twinAttribute.Name].Expected != nil && ((helper.TwinResult.Twin[twinAttribute.Name].Actual == nil) && helper.TwinResult.Twin[twinAttribute.Name].Expected != nil || (*helper.TwinResult.Twin[twinAttribute.Name].Expected.Value != *helper.TwinResult.Twin[twinAttribute.Name].Actual.Value)) { - glog.Infof("%s Expected Value : %s", twinAttribute.Name, *helper.TwinResult.Twin[twinAttribute.Name].Expected.Value) + klog.Infof("%s Expected Value : %s", twinAttribute.Name, *helper.TwinResult.Twin[twinAttribute.Name].Expected.Value) if helper.TwinResult.Twin[twinAttribute.Name].Actual == nil { - glog.Infof("%s Actual Value: %v", twinAttribute.Name, helper.TwinResult.Twin[twinAttribute.Name].Actual) + klog.Infof("%s Actual Value: %v", twinAttribute.Name, helper.TwinResult.Twin[twinAttribute.Name].Actual) } else { - glog.Infof("%s Actual Value: %s", twinAttribute.Name, *helper.TwinResult.Twin[twinAttribute.Name].Actual.Value) + klog.Infof("%s Actual Value: %s", twinAttribute.Name, *helper.TwinResult.Twin[twinAttribute.Name].Actual.Value) } - glog.Infof("Equating the actual value to expected value for: %s", twinAttribute.Name) + klog.Infof("Equating the actual value to expected value for: %s", twinAttribute.Name) for _, watcherAction := range twinAttribute.Actions { actionExists := false for _, action := range actionManager { @@ -181,10 +181,10 @@ func (w *Watcher) EquateTwinValue(deviceID string) error { updateMessage = helper.CreateActualUpdateMessage(updatedActualValues) helper.ChangeTwinValue(updateMessage, deviceID) time.Sleep(2 * time.Second) - glog.Infof("Syncing to cloud.....") + klog.Infof("Syncing to cloud.....") helper.SyncToCloud(updateMessage, deviceID) } else { - glog.Infof("Actual values are in sync with Expected value") + klog.Infof("Actual values are in sync with Expected value") } return nil } |
