Skip to content

Commit

Permalink
Merge pull request #60 from ading1977/fix-logging-errors
Browse files Browse the repository at this point in the history
OM-42925: Fix logging errors
  • Loading branch information
ading1977 authored Feb 20, 2019
2 parents aed6fd0 + 0051f1d commit abf93a0
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.9
- 1.11
- tip

go_import_path: github.com/turbonomic/turbo-go-sdk
Expand Down
8 changes: 4 additions & 4 deletions pkg/builder/entity_dto_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ func TestCreate(t *testing.T) {
}
for _, item := range table {
builder := &EntityDTOBuilder{
entityType: &item.eType,
id: &item.id,
powerState: &item.powerState,
origin: &item.origin,
entityType: &item.eType,
id: &item.id,
powerState: &item.powerState,
origin: &item.origin,
commoditiesBoughtProviderMap: item.commoditiesBoughtProviderMap,
commoditiesSold: item.commoditiesSold,
err: item.err,
Expand Down
2 changes: 1 addition & 1 deletion pkg/mediationcontainer/client_websocket_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (clientTransport *ClientWebSocketTransport) performWebSocketConnection() er
return nil
}
}
glog.V(4).Infof("[performWebSocketConnection] exit connect routine, close = %s ", clientTransport.closeRequested)
glog.V(4).Infof("[performWebSocketConnection] exit connect routine, close = %v ", clientTransport.closeRequested)
return errors.New("Abort client socket connect, transport is closed")
}

Expand Down
24 changes: 12 additions & 12 deletions pkg/mediationcontainer/remote_mediation_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func CreateRemoteMediationClient(allProbes map[string]*ProbeProperties,
stopMediationClientCh: make(chan struct{}),
}

glog.V(4).Infof("Created channels : probeResponseChan %s, stopMediationClientCh %s\n",
glog.V(4).Infof("Created channels : probeResponseChan %+v, stopMediationClientCh %+v",
remoteMediationClient.probeResponseChan, remoteMediationClient.stopMediationClientCh)

// Create message handlers
Expand Down Expand Up @@ -94,7 +94,7 @@ func (remoteMediationClient *remoteMediationClient) Init(probeRegisteredMsgCh ch

status := <-sdkProtocolDoneCh

glog.V(4).Infof("Sdk client protocol complete, status = ", status)
glog.V(4).Infof("Sdk client protocol completed with status %v", status)
if !status {
glog.Errorf("Registration with server failed")
probeRegisteredMsgCh <- status
Expand All @@ -119,7 +119,7 @@ func (remoteMediationClient *remoteMediationClient) Init(probeRegisteredMsgCh ch
err := transport.Connect()
// handle WebSocket creation errors
if err != nil { //transport.ws == nil {
glog.Errorf("[Reconnect] Initialization of remote mediation client failed, null transport")
glog.Errorf("[Reconnect] Initialization of remote mediation client failed: %v", err)
remoteMediationClient.Stop()
break
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func (remoteMediationClient *remoteMediationClient) Init(probeRegisteredMsgCh ch
// Send registration status to the upper layer
defer close(sdkProtocolDoneCh)
probeRegisteredMsgCh <- status
glog.V(3).Infof("Sent registration status on channel %s\n", probeRegisteredMsgCh)
glog.V(3).Infof("Sent registration status on channel %v", probeRegisteredMsgCh)

glog.V(3).Infof("Remote mediation initialization complete")
// --------- Wait for exit notification
Expand Down Expand Up @@ -327,7 +327,7 @@ func (discReqHandler *DiscoveryRequestHandler) HandleMessage(serverRequest proto
t := time.NewTimer(time.Second * 10)
select {
case <-stopCh:
glog.V(4).Infof("Cancel keep alive for msgID ", msgID)
glog.V(4).Infof("Cancel keep alive for msgID %d", msgID)
return
case <-t.C:
}
Expand Down Expand Up @@ -382,10 +382,10 @@ func (valReqHandler *ValidationRequestHandler) HandleMessage(serverRequest proto
probeType := request.ProbeType
probeProps, exist := valReqHandler.probes[*probeType]
if !exist {
glog.Errorf("Received: validation request for unknown probe type : %s", *probeType)
glog.Errorf("Received: validation request for unknown probe type: %s", *probeType)
return
}
glog.V(3).Infof("Received: validation for probe type: %s\n ", *probeType)
glog.V(3).Infof("Received: validation for probe type: %s", *probeType)
turboProbe := probeProps.Probe

var validationResponse *proto.ValidationResponse
Expand All @@ -409,15 +409,15 @@ type ActionMessageHandler struct {

func (actionReqHandler *ActionMessageHandler) HandleMessage(serverRequest proto.MediationServerMessage,
probeMsgChan chan *proto.MediationClientMessage) {
glog.V(4).Infof("[ActionMessageHandler] Received: action %s request", serverRequest)
glog.V(4).Infof("[ActionMessageHandler] Received: action request %s", &serverRequest)
request := serverRequest.GetActionRequest()
probeType := request.ProbeType
if actionReqHandler.probes[*probeType] == nil {
glog.Errorf("Received: Action request for unknown probe type : %s", *probeType)
glog.Errorf("Received: action request for unknown probe type : %s", *probeType)
return
}

glog.V(3).Infof("Received: action %s request for probe type: %s\n ",
glog.V(3).Infof("Received: action request %s for probe type: %s",
request.ActionExecutionDTO.ActionType, *probeType)
probeProps := actionReqHandler.probes[*probeType]
turboProbe := probeProps.Probe
Expand Down Expand Up @@ -449,7 +449,7 @@ func NewActionResponseWorker(msgId int32, turboProbe *probe.TurboProbe,
accountValues: accountValues,
probeMsgChan: probeMsgChan,
}
glog.V(4).Infof("New ActionResponseProtocolWorker for %s %s %s", msgId, turboProbe,
glog.V(4).Infof("New ActionResponseProtocolWorker for %d %+v %s", msgId, turboProbe,
actionExecutionDto.ActionType)
return worker
}
Expand Down Expand Up @@ -494,5 +494,5 @@ func (intMsgHandler *InterruptMessageHandler) HandleMessage(serverRequest proto.
probeMsgChan chan *proto.MediationClientMessage) {

msgID := serverRequest.GetMessageID()
glog.V(3).Infof("Received: Interrupt Message for message ID: %d, %s\n ", msgID, serverRequest)
glog.V(3).Infof("Received: Interrupt Message for message ID: %d, %s", msgID, &serverRequest)
}
5 changes: 3 additions & 2 deletions pkg/mediationcontainer/sdk_client_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"github.com/turbonomic/turbo-go-sdk/pkg/version"

"fmt"
"github.com/golang/glog"
"time"

"github.com/golang/glog"
)

const (
Expand Down Expand Up @@ -158,7 +159,7 @@ func (clientProtocol *SdkClientProtocol) MakeContainerInfo() (*proto.ContainerIn
var probes []*proto.ProbeInfo

for k, v := range clientProtocol.allProbes {
glog.V(2).Infof("SdkClientProtocol] Creating Probe Info for", k)
glog.V(2).Infof("SdkClientProtocol] Creating Probe Info for %s", k)
turboProbe := v.Probe
var probeInfo *proto.ProbeInfo
var err error
Expand Down
2 changes: 1 addition & 1 deletion pkg/probe/probe_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func checkSecondaryDiscoveryInterval(secondaryDiscoverySec int32, discoveryType

if secondaryDiscoverySec < pkg.DEFAULT_MIN_DISCOVERY_IN_SECS {
glog.Warningf("%s discovery interval value of %d is below minimum value allowed."+
" Setting %s discovery interval to minimum allowed value of %d seconds.",
" Setting discovery interval to minimum allowed value of %d seconds.",
discoveryType, secondaryDiscoverySec, pkg.DEFAULT_MIN_DISCOVERY_IN_SECS)
return pkg.DEFAULT_MIN_DISCOVERY_IN_SECS
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/probe/turbo_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package probe

import (
"fmt"

"github.com/turbonomic/turbo-go-sdk/pkg/builder"
"github.com/turbonomic/turbo-go-sdk/pkg/proto"

Expand Down Expand Up @@ -73,7 +74,7 @@ func newTurboProbe(probeConf *ProbeConfig) (*TurboProbe, error) {
RegistrationClient: NewProbeRegistrator(),
}

glog.V(2).Infof("[NewTurboProbe] Created TurboProbe: %s", myProbe)
glog.V(2).Infof("[NewTurboProbe] Created TurboProbe: %v", myProbe)
return myProbe, nil
}

Expand Down
88 changes: 44 additions & 44 deletions pkg/proto/CommonDTO.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/supplychain/supply_chain_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestSupplyChainBuilder_Entity(t *testing.T) {
{
newNodes: []*proto.TemplateDTO{randomSupplyChainNode()},
existingSupplyChainNodes: []*proto.TemplateDTO{},
newErr: fmt.Errorf("Must set top supply chain node first."),
newErr: fmt.Errorf("Must set top supply chain node first."),
},
{
newNodes: []*proto.TemplateDTO{
Expand Down

0 comments on commit abf93a0

Please sign in to comment.