This is an automated email from the ASF dual-hosted git repository.

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new ce61a2f1 [operator] Replacing Print Library Logic and Removing Console 
Printer Related Resources
ce61a2f1 is described below

commit ce61a2f1bd2f2ab487ca6c3339bfc6881df46901
Author: mfordjody <[email protected]>
AuthorDate: Wed Jan 1 10:27:57 2025 +0800

    [operator] Replacing Print Library Logic and Removing Console Printer 
Related Resources
---
 operator/cmd/cluster/uninstall.go     |  1 -
 operator/pkg/uninstall/uninstaller.go |  8 ++++----
 operator/pkg/util/clog/log/config.go  | 16 ---------------
 operator/pkg/util/clog/log/scope.go   | 38 +----------------------------------
 4 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/operator/cmd/cluster/uninstall.go 
b/operator/cmd/cluster/uninstall.go
index b1c97afe..31e77105 100644
--- a/operator/cmd/cluster/uninstall.go
+++ b/operator/cmd/cluster/uninstall.go
@@ -117,7 +117,6 @@ func preCheck(cmd *cobra.Command, uiArgs *uninstallArgs, cl 
*clog.ConsoleLogger,
                message += AllResourcesRemovedWarning
        }
        if dryRun || uiArgs.skipConfirmation {
-               cl.LogAndPrint(message)
                return
        }
        message += "Proceed? (y/N)"
diff --git a/operator/pkg/uninstall/uninstaller.go 
b/operator/pkg/uninstall/uninstaller.go
index e6cba296..82f37fde 100644
--- a/operator/pkg/uninstall/uninstaller.go
+++ b/operator/pkg/uninstall/uninstaller.go
@@ -96,10 +96,10 @@ func DeleteObjectsList(c kube.CLIClient, dryRun bool, log 
clog.Logger, objectsLi
        return errs.ToErrors()
 }
 
-func DeleteResource(kc kube.CLIClient, dryRun bool, cl clog.Logger, obj 
*unstructured.Unstructured) error {
+func DeleteResource(kc kube.CLIClient, dryRun bool, _ clog.Logger, obj 
*unstructured.Unstructured) error {
        name := fmt.Sprintf("%v/%s.%s", obj.GroupVersionKind(), obj.GetName(), 
obj.GetNamespace())
        if dryRun {
-               cl.LogAndPrintf("Not pruning object %s because of dry run.", 
name)
+               fmt.Printf("Not pruning object %s because of dry run.", name)
                return nil
        }
 
@@ -112,12 +112,12 @@ func DeleteResource(kc kube.CLIClient, dryRun bool, cl 
clog.Logger, obj *unstruc
                if !kerrors.IsNotFound(err) {
                        return err
                }
-               cl.LogAndPrintf("object: %s is not being deleted because it no 
longer exists", name)
+               fmt.Printf("object: %s is not being deleted because it no 
longer exists", name)
 
                return nil
        }
 
-       cl.LogAndPrintf("✔︎ Removed %s.\n", name)
+       fmt.Printf("✔︎ Removed %s.\n", name)
 
        return nil
 }
diff --git a/operator/pkg/util/clog/log/config.go 
b/operator/pkg/util/clog/log/config.go
deleted file mode 100644
index 54e996b6..00000000
--- a/operator/pkg/util/clog/log/config.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package log
-
-import (
-       "go.uber.org/atomic"
-       "go.uber.org/zap/zapcore"
-)
-
-var (
-       funcs   = &atomic.Value{}
-       useJSON atomic.Value
-)
-
-type patchTable struct {
-       write     func(ent zapcore.Entry, fields []zapcore.Field) error
-       errorSink zapcore.WriteSyncer
-}
diff --git a/operator/pkg/util/clog/log/scope.go 
b/operator/pkg/util/clog/log/scope.go
index fb1012c9..39c9023d 100644
--- a/operator/pkg/util/clog/log/scope.go
+++ b/operator/pkg/util/clog/log/scope.go
@@ -114,43 +114,7 @@ func (s *Scope) emitWithTime(level zapcore.Level, msg 
string, t time.Time) {
        if dumpStack(level, s) {
                e.Stack = zap.Stack("").String
        }
-
-       var fields []zapcore.Field
-       if useJSON.Load().(bool) {
-               fields = make([]zapcore.Field, 0, len(s.labelKeys))
-               for _, k := range s.labelKeys {
-                       v := s.labels[k]
-                       fields = append(fields, zap.Field{
-                               Key:       k,
-                               Interface: v,
-                               Type:      zapcore.ReflectType,
-                       })
-               }
-       } else if len(s.labelKeys) > 0 {
-               sb := &strings.Builder{}
-               sb.Grow(len(msg) + 15*len(s.labelKeys))
-               sb.WriteString(msg)
-               sb.WriteString("\t")
-               space := false
-               for _, k := range s.labelKeys {
-                       if space {
-                               sb.WriteString(" ")
-                       }
-                       sb.WriteString(k)
-                       sb.WriteString("=")
-                       sb.WriteString(fmt.Sprint(s.labels[k]))
-                       space = true
-               }
-               e.Message = sb.String()
-       }
-
-       pt := funcs.Load().(patchTable)
-       if pt.write != nil {
-               if err := pt.write(e, fields); err != nil {
-                       _, _ = fmt.Fprintf(pt.errorSink, "%v log write error: 
%v\n", time.Now(), err)
-                       _ = pt.errorSink.Sync()
-               }
-       }
+       // TODO
 }
 
 func (s *Scope) GetLogCallers() bool {

Reply via email to