feat: Silence logs (#2538)

Signed-off-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
liujian 2025-04-18 10:17:33 +08:00 committed by GitHub
parent 2dead130da
commit dc8717479b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -50,6 +50,7 @@ func NewRootCommand() *cobra.Command {
PersistentPostRunE: func(*cobra.Command, []string) error {
return options.FlushProfiling()
},
SilenceUsage: true,
}
cmd.SetContext(signals.SetupSignalHandler())
// add common flag

View File

@ -17,6 +17,7 @@ limitations under the License.
package main
import (
"flag"
"fmt"
"os"
@ -25,7 +26,12 @@ import (
func main() {
if err := app.NewRootCommand().Execute(); err != nil {
fmt.Printf("%+v", err)
vFlag := flag.Lookup("v")
if vFlag != nil {
fmt.Printf("%+v", err)
} else {
fmt.Printf("%v", err)
}
os.Exit(1)
}
}