cmd

package
v0.0.0-...-feac9d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "arke",
	Short: "TBD",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		lvl := zap.NewAtomicLevel()

		if viper.GetBool("verbose") {
			lvl.SetLevel(zap.DebugLevel)
		} else if viper.IsSet("log.level") {
			switch viper.GetString("log.level") {
			case "debug":
				lvl.SetLevel(zap.DebugLevel)
			case "warn":
				lvl.SetLevel(zap.WarnLevel)
			case "dpanic":
				lvl.SetLevel(zap.DPanicLevel)
			case "error":
				lvl.SetLevel(zap.ErrorLevel)
			case "fatal":
				lvl.SetLevel(zap.FatalLevel)
			case "info":
				lvl.SetLevel(zap.InfoLevel)
			case "panic":
				lvl.SetLevel(zap.PanicLevel)
			default:
				return errors.New("Unknown Logging Level")
			}
		}
		var err error
		log, err = zap.NewProduction()
		log.Core().Enabled(lvl.Level())
		return err
	},
}

RootCmd exports the main arke command interface, including all subcommands

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL