Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Level settings don't work as expected #152

Closed
jeff-mccoy opened this issue Nov 3, 2021 · 0 comments · Fixed by #156
Closed

Log Level settings don't work as expected #152

jeff-mccoy opened this issue Nov 3, 2021 · 0 comments · Fixed by #156
Assignees
Labels
bug 🐞 Something isn't working

Comments

@jeff-mccoy
Copy link
Contributor

We probably need to verify the E2E for this, but the way the log levels are currently configured shouldn't work properly (and doesn't for me). Issue is we are using logrus.New() and then setting the log level vs just logrus.SetLevel(). Recommend we just push that to the root.cmd such as below:

var rootCmd = &cobra.Command{
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		setLogLevel(zarfLogLevel)
	},
...

func setLogLevel(logLevel string) {
	switch logLevel {
	case "debug":
		logrus.SetLevel(logrus.DebugLevel)
	case "info":
		logrus.SetLevel(logrus.InfoLevel)
	case "warn":
		logrus.SetLevel(logrus.WarnLevel)
	case "error":
		logrus.SetLevel(logrus.ErrorLevel)
	case "fatal":
		logrus.SetLevel(logrus.FatalLevel)
	case "panic":
		logrus.SetLevel(logrus.PanicLevel)
	default:
		logrus.Fatal("Unrecongized log level entry: %s", logLevel)
	}
}
@jeff-mccoy jeff-mccoy added the bug 🐞 Something isn't working label Nov 3, 2021
@YrrepNoj YrrepNoj self-assigned this Nov 4, 2021
@YrrepNoj YrrepNoj linked a pull request Nov 4, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants