diff --git a/cmd/centry/runtime.go b/cmd/centry/runtime.go index ecd1ead..2879a47 100644 --- a/cmd/centry/runtime.go +++ b/cmd/centry/runtime.go @@ -186,7 +186,7 @@ func handleCommandNotFound(runtime *Runtime, c *cli.Context, command string) { logger := runtime.context.log.GetLogger() logger.WithFields(logrus.Fields{ "command": command, - }).Warnf("command not found!") + }).Warnf("command not found") c.App.Metadata[metadataExitCode] = 127 } diff --git a/cmd/centry/runtime_test.go b/cmd/centry/runtime_test.go index 064bf29..6353bbf 100644 --- a/cmd/centry/runtime_test.go +++ b/cmd/centry/runtime_test.go @@ -488,7 +488,7 @@ OPTIONS: g.It("should display internal options when hide is set to false", func() { out := execQuiet("", "test/data/runtime_test_display_internal_options.yaml") expected := `OPTIONS: - --centry-config-log-level value Overrides the log level + --centry-config-log-level value Overrides the log level (default: "info") --centry-quiet Disables logging (default: false)` test.AssertStringContains(g, out.Stdout, expected) diff --git a/internal/pkg/config/manifest.go b/internal/pkg/config/manifest.go index 1ec8c21..15eb9ef 100644 --- a/internal/pkg/config/manifest.go +++ b/internal/pkg/config/manifest.go @@ -12,6 +12,10 @@ import ( yaml2 "gopkg.in/yaml.v2" ) +const ( + defaultLogLevel string = "info" +) + // Manifest defines the structure of a manifest type Manifest struct { Scripts []string `yaml:"scripts,omitempty"` @@ -117,6 +121,9 @@ func readManifestFile(filename string) ([]byte, error) { func parseManifestYaml(bs []byte) (*Manifest, error) { m := Manifest{ Config: Config{ + Log: LogConfig{ + Level: defaultLogLevel, + }, HideInternalCommands: true, HideInternalOptions: true, }, diff --git a/internal/pkg/log/manager.go b/internal/pkg/log/manager.go index 1cab405..e087cbd 100644 --- a/internal/pkg/log/manager.go +++ b/internal/pkg/log/manager.go @@ -36,7 +36,7 @@ func CreateManager(level string, prefix string, io io.InputOutput) *Manager { func (m *Manager) GetLogger() *logrus.Logger { if m.logger == nil { m.logger = logrus.New() - m.logger.Out = m.config.IO.Stderr // TODO: Change to using Stdout + m.logger.Out = m.config.IO.Stderr // TODO: Allow changing to Stdout l, _ := logrus.ParseLevel(m.config.Level) m.logger.SetLevel(l)