mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-23 22:46:53 +00:00
Add Logging Convention in CONTRIBUTING.md (#1762)
* add logging convention in contributing * fix log
This commit is contained in:
@@ -29,7 +29,6 @@ import (
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
"github.com/oam-dev/kubevela/pkg/controller/common"
|
||||
)
|
||||
|
||||
// issue an http call to the an end ponit
|
||||
@@ -125,7 +124,7 @@ func callWebhook(ctx context.Context, resource klog.KMetadata, phase string, rw
|
||||
}
|
||||
if !accepted {
|
||||
err := fmt.Errorf("http request to the webhook not accepeted, http status = %d", status)
|
||||
klog.V(common.LogDebug).InfoS("the status is not expected", "expected status", rw.ExpectedStatus)
|
||||
klog.ErrorS(err, "The status is not expected", "expected status", rw.ExpectedStatus)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
+6
-6
@@ -225,7 +225,7 @@ func (r *OAMApplicationReconciler) Reconcile(req reconcile.Request) (reconcile.R
|
||||
}
|
||||
} else {
|
||||
if err := r.workloads.Finalize(ctx, ac); err != nil {
|
||||
klog.V(common.LogDebug).InfoS("Failed to finalize workloads", "workloads status", ac.Status.Workloads,
|
||||
klog.InfoS("Failed to finalize workloads", "workloads status", ac.Status.Workloads,
|
||||
"err", err)
|
||||
r.record.Event(ac, event.Warning(reasonCannotFinalizeWorkloads, err))
|
||||
ac.SetConditions(v1alpha1.ReconcileError(errors.Wrap(err, errFinalizeWorkloads)))
|
||||
@@ -254,7 +254,7 @@ func (r *OAMApplicationReconciler) ACReconcile(ctx context.Context, ac *v1alpha2
|
||||
for name, hook := range r.postHooks {
|
||||
exeResult, err := hook.Exec(ctx, ac)
|
||||
if err != nil {
|
||||
klog.V(common.LogDebug).InfoS("Failed to execute post-hooks", "hook name", name, "error", err,
|
||||
klog.InfoS("Failed to execute post-hooks", "hook name", name, "err", err,
|
||||
"requeue-after", result.RequeueAfter)
|
||||
r.record.Event(ac, event.Warning(reasonCannotExecutePosthooks, err))
|
||||
ac.SetConditions(v1alpha1.ReconcileError(errors.Wrap(err, errExecutePosthooks)))
|
||||
@@ -270,7 +270,7 @@ func (r *OAMApplicationReconciler) ACReconcile(ctx context.Context, ac *v1alpha2
|
||||
for name, hook := range r.preHooks {
|
||||
result, err := hook.Exec(ctx, ac)
|
||||
if err != nil {
|
||||
klog.V(common.LogDebug).InfoS("Failed to execute pre-hooks", "hook name", name, "error", err, "requeue-after", result.RequeueAfter)
|
||||
klog.InfoS("Failed to execute pre-hooks", "hook name", name, "requeue-after", result.RequeueAfter, "err", err)
|
||||
r.record.Event(ac, event.Warning(reasonCannotExecutePrehooks, err))
|
||||
ac.SetConditions(v1alpha1.ReconcileError(errors.Wrap(err, errExecutePrehooks)))
|
||||
return result
|
||||
@@ -306,7 +306,7 @@ func (r *OAMApplicationReconciler) ACReconcile(ctx context.Context, ac *v1alpha2
|
||||
|
||||
applyOpts := []apply.ApplyOption{apply.MustBeControllableBy(ac.GetUID()), applyOnceOnly(ac, r.applyOnceOnlyMode)}
|
||||
if err := r.workloads.Apply(ctx, ac.Status.Workloads, workloads, applyOpts...); err != nil {
|
||||
klog.V(common.LogDebug).InfoS("Cannot apply workload", "err", err)
|
||||
klog.InfoS("Cannot apply workload", "err", err)
|
||||
r.record.Event(ac, event.Warning(reasonCannotApplyComponents, err))
|
||||
ac.SetConditions(v1alpha1.ReconcileError(errors.Wrap(err, errApplyComponents)))
|
||||
return reconcile.Result{}
|
||||
@@ -334,13 +334,13 @@ func (r *OAMApplicationReconciler) ACReconcile(ctx context.Context, ac *v1alpha2
|
||||
|
||||
err := r.confirmDeleteOnApplyOnceMode(ctx, ac.GetNamespace(), &e)
|
||||
if err != nil {
|
||||
klog.V(common.LogDebug).InfoS("Confirm component can't be garbage collected", "err", err)
|
||||
klog.InfoS("Confirm component can't be garbage collected", "err", err)
|
||||
record.Event(ac, event.Warning(reasonCannotGGComponents, err))
|
||||
ac.SetConditions(v1alpha1.ReconcileError(errors.Wrap(err, errGCComponent)))
|
||||
return reconcile.Result{}
|
||||
}
|
||||
if err := r.client.Delete(ctx, &e); resource.IgnoreNotFound(err) != nil {
|
||||
klog.V(common.LogDebug).InfoS("Cannot garbage collect component", "err", err)
|
||||
klog.InfoS("Cannot garbage collect component", "err", err)
|
||||
record.Event(ac, event.Warning(reasonCannotGGComponents, err))
|
||||
ac.SetConditions(v1alpha1.ReconcileError(errors.Wrap(err, errGCComponent)))
|
||||
return reconcile.Result{}
|
||||
|
||||
Reference in New Issue
Block a user