Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "kcp", Short: "A CLI tool for kafka cluster planning and migration", Long: "A comprehensive CLI tool for planning and executing kafka cluster migrations to confluent cloud. Docs: " + getDocURL(), PersistentPreRun: func(cmd *cobra.Command, args []string) { lumberjackLogger := &lumberjack.Logger{ Filename: "kcp.log", MaxSize: 25, Compress: true, } fileHandler := NewPrettyHandler(lumberjackLogger, PrettyHandlerOptions{ SlogOpts: slog.HandlerOptions{ Level: slog.LevelDebug, }, }) consoleLevel := slog.LevelWarn if verbose { consoleLevel = slog.LevelDebug } consoleHandler := NewPrettyHandler(os.Stdout, PrettyHandlerOptions{ SlogOpts: slog.HandlerOptions{ Level: consoleLevel, }, }) logger := slog.New(NewFanOutHandler(fileHandler, consoleHandler)) slog.SetDefault(logger) if build_info.Version == "dev" { fmt.Printf("\n%s\n%s\n%s\n%s\n\n", color.RedString("┌─────────────────────────────────────────────────────────────────────────┐"), color.RedString("│ ⚠️ WARNING: This is a development build │"), color.RedString("│ Official releases: https://github.com/confluentinc/kcp/releases │"), color.RedString("└─────────────────────────────────────────────────────────────────────────┘")) } fmt.Printf("%s %s %s %s\n", color.CyanString("Executing kcp with build"), color.GreenString("version=%s", build_info.Version), color.YellowString("commit=%s", build_info.Commit), color.BlueString("date=%s", build_info.Date)) if err := checkWritePermissions(); err != nil { fmt.Fprintf(os.Stderr, "%s\n", color.RedString("Error: %v", err)) os.Exit(1) } }, }
Functions ¶
This section is empty.
Types ¶
type FanOutHandler ¶ added in v0.7.0
type FanOutHandler struct {
// contains filtered or unexported fields
}
func NewFanOutHandler ¶ added in v0.7.0
func NewFanOutHandler(handlers ...slog.Handler) *FanOutHandler
type PrettyHandler ¶
func NewPrettyHandler ¶
func NewPrettyHandler( out io.Writer, opts PrettyHandlerOptions, ) *PrettyHandler
type PrettyHandlerOptions ¶
type PrettyHandlerOptions struct {
SlogOpts slog.HandlerOptions
}
Click to show internal directories.
Click to hide internal directories.