Improve error/debug message

This diff changes error message with fixed format for easy-to-read
for users.
This commit is contained in:
Tomofumi Hayashi
2019-10-02 18:02:26 +09:00
committed by Doug Smith
parent f4431cd010
commit 0a2f7b18d3
7 changed files with 113 additions and 109 deletions

View File

@@ -64,7 +64,7 @@ func getCheckpoint(filePath string) (types.ResourceClient, error) {
if err != nil {
return nil, err
}
logging.Debugf("getCheckpoint(): created checkpoint instance with file: %s", filePath)
logging.Debugf("getCheckpoint: created checkpoint instance with file: %s", filePath)
return cp, nil
}
@@ -74,15 +74,15 @@ func (cp *checkpoint) getPodEntries() error {
cpd := &checkpointFileData{}
rawBytes, err := ioutil.ReadFile(cp.fileName)
if err != nil {
return logging.Errorf("getPodEntries(): error reading file %s\n%v\n", checkPointfile, err)
return logging.Errorf("getPodEntries: error reading file %s\n%v\n", checkPointfile, err)
}
if err = json.Unmarshal(rawBytes, cpd); err != nil {
return logging.Errorf("getPodEntries(): error unmarshalling raw bytes %v", err)
return logging.Errorf("getPodEntries: error unmarshalling raw bytes %v", err)
}
cp.podEntires = cpd.Data.PodDeviceEntries
logging.Debugf("getPodEntries(): podEntires %+v", cp.podEntires)
logging.Debugf("getPodEntries: podEntires %+v", cp.podEntires)
return nil
}
@@ -92,7 +92,7 @@ func (cp *checkpoint) GetPodResourceMap(pod *v1.Pod) (map[string]*types.Resource
resourceMap := make(map[string]*types.ResourceInfo)
if podID == "" {
return nil, logging.Errorf("GetPodResourceMap(): invalid Pod cannot be empty")
return nil, logging.Errorf("GetPodResourceMap: invalid Pod cannot be empty")
}
for _, pod := range cp.podEntires {
if pod.PodUID == podID {