fix warning messages
Use log.Warnf instead of log.Infof, and remove redundant `WARNING` prefix. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
c7bac5a484
commit
d16f6bdb38
1 changed files with 3 additions and 3 deletions
|
@ -20,20 +20,20 @@ func New(quiet bool) *SysInfo {
|
||||||
sysInfo := &SysInfo{}
|
sysInfo := &SysInfo{}
|
||||||
if cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory"); err != nil {
|
if cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory"); err != nil {
|
||||||
if !quiet {
|
if !quiet {
|
||||||
log.Printf("WARNING: %s\n", err)
|
log.Warnf("%s", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_, err1 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.limit_in_bytes"))
|
_, err1 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.limit_in_bytes"))
|
||||||
_, err2 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.soft_limit_in_bytes"))
|
_, err2 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.soft_limit_in_bytes"))
|
||||||
sysInfo.MemoryLimit = err1 == nil && err2 == nil
|
sysInfo.MemoryLimit = err1 == nil && err2 == nil
|
||||||
if !sysInfo.MemoryLimit && !quiet {
|
if !sysInfo.MemoryLimit && !quiet {
|
||||||
log.Printf("WARNING: Your kernel does not support cgroup memory limit.")
|
log.Warnf("Your kernel does not support cgroup memory limit.")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.memsw.limit_in_bytes"))
|
_, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.memsw.limit_in_bytes"))
|
||||||
sysInfo.SwapLimit = err == nil
|
sysInfo.SwapLimit = err == nil
|
||||||
if !sysInfo.SwapLimit && !quiet {
|
if !sysInfo.SwapLimit && !quiet {
|
||||||
log.Printf("WARNING: Your kernel does not support cgroup swap limit.")
|
log.Warnf("Your kernel does not support cgroup swap limit.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue