cleanup: Avoid usage of numbers

Add seperate functions to handle all
levels and types of logging.

Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
Yug
2020-07-09 20:18:24 +05:30
committed by mergify[bot]
parent 8dc4ab6b1b
commit 1490daed7e
26 changed files with 186 additions and 114 deletions

View File

@ -71,8 +71,7 @@ func getOMapValues(
return nil, err
}
klog.V(4).Infof(
util.Log(ctx, "got omap values: (pool=%q, namespace=%q, name=%q): %+v"),
util.DebugLog(ctx, "got omap values: (pool=%q, namespace=%q, name=%q): %+v",
poolName, namespace, oid, results)
return results, nil
}
@ -98,8 +97,7 @@ func removeMapKeys(
// the previous implementation of removing omap keys (via the cli)
// treated failure to find the omap as a non-error. Do so here to
// mimic the previous behavior.
klog.V(4).Infof(
util.Log(ctx, "when removing omap keys, omap not found (pool=%q, namespace=%q, name=%q): %+v"),
util.DebugLog(ctx, "when removing omap keys, omap not found (pool=%q, namespace=%q, name=%q): %+v",
poolName, namespace, oid, keys)
} else {
klog.Errorf(
@ -108,8 +106,7 @@ func removeMapKeys(
return err
}
}
klog.V(4).Infof(
util.Log(ctx, "removed omap keys (pool=%q, namespace=%q, name=%q): %+v"),
util.DebugLog(ctx, "removed omap keys (pool=%q, namespace=%q, name=%q): %+v",
poolName, namespace, oid, keys)
return nil
}
@ -140,8 +137,7 @@ func setOMapKeys(
poolName, namespace, oid, pairs, err)
return err
}
klog.V(4).Infof(
util.Log(ctx, "set omap keys (pool=%q, namespace=%q, name=%q): %+v)"),
util.DebugLog(ctx, "set omap keys (pool=%q, namespace=%q, name=%q): %+v)",
poolName, namespace, oid, pairs)
return nil
}

View File

@ -449,7 +449,7 @@ func reserveOMapName(ctx context.Context, monitors string, cr *util.Credentials,
if errors.As(err, &eoe) {
attempt++
// try again with a different uuid, for maxAttempts tries
klog.V(4).Infof(util.Log(ctx, "uuid (%s) conflict detected, retrying (attempt %d of %d)"),
util.DebugLog(ctx, "uuid (%s) conflict detected, retrying (attempt %d of %d)",
iterUUID, attempt, maxAttempts)
continue
}