mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 01:45:44 +03:00
clean up some log formatting
This commit is contained in:
@@ -121,7 +121,7 @@ func (f *EnvAWSFingerprint) Fingerprint(cfg *config.Config, node *structs.Node)
|
||||
resp, err := ioutil.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
f.logger.Printf("[ERR]: fingerprint.env_aws: Error reading response body for AWS %s", k)
|
||||
}
|
||||
|
||||
// assume we want blank entries
|
||||
@@ -209,7 +209,7 @@ func (f *EnvAWSFingerprint) linkSpeed() int {
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
f.logger.Printf("[ERR]: fingerprint.env_aws: Error reading response body for instance-type")
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ func (f *NetworkFingerprint) linkSpeed(device string) int {
|
||||
return speed
|
||||
}
|
||||
}
|
||||
f.logger.Printf("[WARN] fingerprint.network_aws: Ethtool not found, checking /sys/net speed file")
|
||||
f.logger.Printf("[WARN] fingerprint.network: Ethtool not found, checking /sys/net speed file")
|
||||
|
||||
// Fall back on checking a system file for link speed.
|
||||
return f.linkSpeedSys(device)
|
||||
@@ -91,7 +91,7 @@ func (f *NetworkFingerprint) linkSpeedSys(device string) int {
|
||||
path := fmt.Sprintf("/sys/class/net/%s/speed", device)
|
||||
_, err := os.Stat(path)
|
||||
if err != nil {
|
||||
log.Printf("[WARN] Error getting information about net speed")
|
||||
f.logger.Printf("[WARN] fingerprint.network: Error getting information about net speed")
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ func (f *NetworkFingerprint) linkSpeedSys(device string) int {
|
||||
// convert to MB/s
|
||||
mbs, err := strconv.Atoi(lines[0])
|
||||
if err != nil {
|
||||
f.logger.Println("[WARN] fingerprint.network_aws: Enable to parse ethtool output")
|
||||
f.logger.Println("[WARN] fingerprint.network: Enable to parse ethtool output")
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ func (f *NetworkFingerprint) linkSpeedEthtool(path, device string) int {
|
||||
m := re.FindString(output)
|
||||
if m == "" {
|
||||
// no matches found, output may be in a different format
|
||||
f.logger.Println("[WARN] fingerprint.network_aws: Ethtool output did not match regex")
|
||||
f.logger.Println("[WARN] fingerprint.network: Ethtool output did not match regex")
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ func (f *NetworkFingerprint) linkSpeedEthtool(path, device string) int {
|
||||
// convert to MB/s
|
||||
mbs, err := strconv.Atoi(raw)
|
||||
if err != nil {
|
||||
f.logger.Println("[WARN] fingerprint.network_aws: Unable to parse ethtool output")
|
||||
f.logger.Println("[WARN] fingerprint.network: Unable to parse ethtool output")
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ func (f *NetworkFingerprint) linkSpeedEthtool(path, device string) int {
|
||||
return mbs
|
||||
}
|
||||
}
|
||||
f.logger.Printf("[ERR] fingerprint.network_aws: Error calling ethtool (%s): %s", path, err)
|
||||
f.logger.Printf("[ERR] fingerprint.network: Error calling ethtool (%s): %s", path, err)
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -183,10 +183,10 @@ func (f *NetworkFingerprint) ifConfig(device string) string {
|
||||
return ip
|
||||
}
|
||||
}
|
||||
f.logger.Printf("[ERR] fingerprint.network_aws: Error calling ifconfig (%s): %s", ifConfigPath, err)
|
||||
f.logger.Printf("[ERR] fingerprint.network: Error calling ifconfig (%s): %s", ifConfigPath, err)
|
||||
return ""
|
||||
}
|
||||
|
||||
f.logger.Println("[WARN] fingerprint.network_aws: Ethtool not found")
|
||||
f.logger.Println("[WARN] fingerprint.network: Ethtool not found")
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user