Add .Send() call to logs without .Msg() call

This commit is contained in:
M. Mert Yildiran 2022-11-29 03:55:50 +03:00
parent 36594d70ea
commit 4892c9dbdc
No known key found for this signature in database
GPG Key ID: DA5D6DCBB758A461
9 changed files with 13 additions and 13 deletions

View File

@ -21,7 +21,7 @@ func init() {
defaultCheckConfig := configStructs.CheckConfig{} defaultCheckConfig := configStructs.CheckConfig{}
if err := defaults.Set(&defaultCheckConfig); err != nil { if err := defaults.Set(&defaultCheckConfig); err != nil {
log.Error().Err(err) log.Error().Err(err).Send()
} }
checkCmd.Flags().Bool(configStructs.PreTapCheckName, defaultCheckConfig.PreTap, "Check pre-tap Kubeshark installation for potential problems") checkCmd.Flags().Bool(configStructs.PreTapCheckName, defaultCheckConfig.PreTap, "Check pre-tap Kubeshark installation for potential problems")

View File

@ -93,7 +93,7 @@ func handleKubernetesProviderError(err error) {
if ok := errors.As(err, &clusterBehindProxyErr); ok { if ok := errors.As(err, &clusterBehindProxyErr); ok {
log.Error().Msg(fmt.Sprintf("Cannot establish http-proxy connection to the Kubernetes cluster. If youre using Lens or similar tool, please run kubeshark with regular kubectl config using --%v %v=$HOME/.kube/config flag", config.SetCommandName, config.KubeConfigPathConfigName)) log.Error().Msg(fmt.Sprintf("Cannot establish http-proxy connection to the Kubernetes cluster. If youre using Lens or similar tool, please run kubeshark with regular kubectl config using --%v %v=$HOME/.kube/config flag", config.SetCommandName, config.KubeConfigPathConfigName))
} else { } else {
log.Error().Err(err) log.Error().Err(err).Send()
} }
} }

View File

@ -48,7 +48,7 @@ func init() {
defaultConfig := config.CreateDefaultConfig() defaultConfig := config.CreateDefaultConfig()
if err := defaults.Set(&defaultConfig); err != nil { if err := defaults.Set(&defaultConfig); err != nil {
log.Debug().Err(err) log.Debug().Err(err).Send()
} }
configCmd.Flags().BoolP(configStructs.RegenerateConfigName, "r", defaultConfig.Config.Regenerate, fmt.Sprintf("Regenerate the config file with default values to path %s or to chosen path using --%s", defaultConfig.ConfigFilePath, config.ConfigFilePathCommandName)) configCmd.Flags().BoolP(configStructs.RegenerateConfigName, "r", defaultConfig.Config.Regenerate, fmt.Sprintf("Regenerate the config file with default values to path %s or to chosen path using --%s", defaultConfig.ConfigFilePath, config.ConfigFilePathCommandName))

View File

@ -41,7 +41,7 @@ func init() {
defaultLogsConfig := configStructs.LogsConfig{} defaultLogsConfig := configStructs.LogsConfig{}
if err := defaults.Set(&defaultLogsConfig); err != nil { if err := defaults.Set(&defaultLogsConfig); err != nil {
log.Debug().Err(err) log.Debug().Err(err).Send()
} }
logsCmd.Flags().StringP(configStructs.FileLogsName, "f", defaultLogsConfig.FileStr, "Path for zip file (default current <pwd>\\kubeshark_logs.zip)") logsCmd.Flags().StringP(configStructs.FileLogsName, "f", defaultLogsConfig.FileStr, "Path for zip file (default current <pwd>\\kubeshark_logs.zip)")

View File

@ -17,7 +17,7 @@ var rootCmd = &cobra.Command{
Further info is available at https://github.com/kubeshark/kubeshark`, Further info is available at https://github.com/kubeshark/kubeshark`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error { PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if err := config.InitConfig(cmd); err != nil { if err := config.InitConfig(cmd); err != nil {
log.Fatal().Err(err) log.Fatal().Err(err).Send()
} }
return nil return nil
@ -27,7 +27,7 @@ Further info is available at https://github.com/kubeshark/kubeshark`,
func init() { func init() {
defaultConfig := config.CreateDefaultConfig() defaultConfig := config.CreateDefaultConfig()
if err := defaults.Set(&defaultConfig); err != nil { if err := defaults.Set(&defaultConfig); err != nil {
log.Debug().Err(err) log.Debug().Err(err).Send()
} }
rootCmd.PersistentFlags().StringSlice(config.SetCommandName, []string{}, fmt.Sprintf("Override values using --%s", config.SetCommandName)) rootCmd.PersistentFlags().StringSlice(config.SetCommandName, []string{}, fmt.Sprintf("Override values using --%s", config.SetCommandName))

View File

@ -44,7 +44,7 @@ func init() {
defaultTapConfig := configStructs.TapConfig{} defaultTapConfig := configStructs.TapConfig{}
if err := defaults.Set(&defaultTapConfig); err != nil { if err := defaults.Set(&defaultTapConfig); err != nil {
log.Debug().Err(err) log.Debug().Err(err).Send()
} }
tapCmd.Flags().Uint16P(configStructs.GuiPortTapName, "p", defaultTapConfig.GuiPort, "Provide a custom port for the web interface webserver") tapCmd.Flags().Uint16P(configStructs.GuiPortTapName, "p", defaultTapConfig.GuiPort, "Provide a custom port for the web interface webserver")

View File

@ -21,13 +21,13 @@ func init() {
defaultViewConfig := configStructs.ViewConfig{} defaultViewConfig := configStructs.ViewConfig{}
if err := defaults.Set(&defaultViewConfig); err != nil { if err := defaults.Set(&defaultViewConfig); err != nil {
log.Error().Err(err) log.Error().Err(err).Send()
} }
viewCmd.Flags().Uint16P(configStructs.GuiPortViewName, "p", defaultViewConfig.GuiPort, "Provide a custom port for the web interface webserver") viewCmd.Flags().Uint16P(configStructs.GuiPortViewName, "p", defaultViewConfig.GuiPort, "Provide a custom port for the web interface webserver")
viewCmd.Flags().StringP(configStructs.UrlViewName, "u", defaultViewConfig.Url, "Provide a custom host") viewCmd.Flags().StringP(configStructs.UrlViewName, "u", defaultViewConfig.Url, "Provide a custom host")
if err := viewCmd.Flags().MarkHidden(configStructs.UrlViewName); err != nil { if err := viewCmd.Flags().MarkHidden(configStructs.UrlViewName); err != nil {
log.Error().Err(err) log.Error().Err(err).Send()
} }
} }

View File

@ -139,20 +139,20 @@ func initFlag(f *pflag.Flag) {
sliceValue, isSliceValue := f.Value.(pflag.SliceValue) sliceValue, isSliceValue := f.Value.(pflag.SliceValue)
if !isSliceValue { if !isSliceValue {
if err := mergeFlagValue(configElemValue, flagPath, strings.Join(flagPath, "."), f.Value.String()); err != nil { if err := mergeFlagValue(configElemValue, flagPath, strings.Join(flagPath, "."), f.Value.String()); err != nil {
log.Warn().Err(err) log.Warn().Err(err).Send()
} }
return return
} }
if f.Name == SetCommandName { if f.Name == SetCommandName {
if err := mergeSetFlag(configElemValue, sliceValue.GetSlice()); err != nil { if err := mergeSetFlag(configElemValue, sliceValue.GetSlice()); err != nil {
log.Warn().Err(err) log.Warn().Err(err).Send()
} }
return return
} }
if err := mergeFlagValues(configElemValue, flagPath, strings.Join(flagPath, "."), sliceValue.GetSlice()); err != nil { if err := mergeFlagValues(configElemValue, flagPath, strings.Join(flagPath, "."), sliceValue.GetSlice()); err != nil {
log.Warn().Err(err) log.Warn().Err(err).Send()
} }
} }

View File

@ -56,7 +56,7 @@ func FilteredWatch(ctx context.Context, watcherCreator WatchCreator, targetNames
} else { } else {
if !watchRestartDebouncer.IsOn() { if !watchRestartDebouncer.IsOn() {
if err := watchRestartDebouncer.SetOn(); err != nil { if err := watchRestartDebouncer.SetOn(); err != nil {
log.Error().Err(err) log.Error().Err(err).Send()
} }
log.Warn().Msg("K8s watch channel closed, restarting watcher...") log.Warn().Msg("K8s watch channel closed, restarting watcher...")
time.Sleep(time.Second * 5) time.Sleep(time.Second * 5)