Replace all instances of wwlog.Printf
wwlog provides named loggers for each level, which requires less code and is clearer than wwlog.Printf. The code has included a mix of both, but this commit consolidates existing code on the per-level functions. Signed-off-by: Jonathon Anderson <janderson@ciq.co>
This commit is contained in:
@@ -16,13 +16,13 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
nodeDB, err := node.New()
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "Failed to open node database: %s\n", err)
|
||||
wwlog.Error("Failed to open node database: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
profiles, err := nodeDB.FindAllProfiles()
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "Could not load all profiles: %s\n", err)
|
||||
wwlog.Error("Could not load all profiles: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@@ -31,13 +31,13 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
if p.Id.Get() == r {
|
||||
nodes, err := nodeDB.FindAllNodes()
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "Could not load all nodes: %s\n", err)
|
||||
wwlog.Error("Could not load all nodes: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
for _, n := range nodes {
|
||||
for _, np := range n.Profiles.GetSlice() {
|
||||
if np == r {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Removing profile from node %s: %s\n", n.Id.Get(), r)
|
||||
wwlog.Verbose("Removing profile from node %s: %s\n", n.Id.Get(), r)
|
||||
n.Profiles.SliceRemoveElement(r)
|
||||
err := nodeDB.NodeUpdate(n)
|
||||
if err != nil {
|
||||
@@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
found = true
|
||||
err := nodeDB.DelProfile(r)
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||
wwlog.Error("%s\n", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user