Documentation
¶
Index ¶
- func GetLogger(cmd *cobra.Command) *slog.Logger
- func SetDefaults(v *viper.Viper, args Arguments) error
- func SetJSONLogger(cmd *cobra.Command, debug bool)
- func SetLogger(cmd *cobra.Command, logger *slog.Logger)
- func SetPersistentFlags(cmd *cobra.Command, v *viper.Viper, args Arguments) error
- func SetTextLogger(cmd *cobra.Command, debug bool)
- type Argument
- type Arguments
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLogger ¶
GetLogger returns the logger from the command's context. If no logger was set, it returns slog.Default().
func SetDefaults ¶
SetDefaults sets up default values in viper.
func SetJSONLogger ¶
SetJSONLogger creates a slog.Logger with a slog.JSONHandler and adds it to the command's context. If debug is true, the handler's log level is set to slog.LevelDebug.
func SetPersistentFlags ¶
SetPersistentFlags adds the arguments and their default values to a cobra.Command as PersistentFlags and binds them to viper.
func SetTextLogger ¶
SetTextLogger creates a slog.Logger with a slog.TextHandler and adds it to the command's context. If debug is true, the handler's log level is set to slog.LevelDebug.
Types ¶
Click to show internal directories.
Click to hide internal directories.