From ecfff31a9f9541f16af349daae88959d9b54f9c1 Mon Sep 17 00:00:00 2001 From: James Kwon Date: Fri, 25 Aug 2023 18:25:08 -0400 Subject: [PATCH] Address test failure --- commands/cli.go | 1 - logging/logger.go | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commands/cli.go b/commands/cli.go index 9a13a56b..a8a70a8b 100644 --- a/commands/cli.go +++ b/commands/cli.go @@ -24,7 +24,6 @@ import ( // CreateCli - Create the CLI app with all commands, flags, and usage text configured. func CreateCli(version string) *cli.App { app := cli.NewApp() - logging.InitLogger() _, disableTelemetryFlag := os.LookupEnv("DISABLE_TELEMETRY") if !disableTelemetryFlag { ui.WarningMessage("This program sends telemetry to Gruntwork. To disable, set DISABLE_TELEMETRY=true as an environment variable") diff --git a/logging/logger.go b/logging/logger.go index 06fd0bd4..6efb4bdf 100644 --- a/logging/logger.go +++ b/logging/logger.go @@ -5,14 +5,15 @@ import ( "os" ) -var Logger *logrus.Logger +var Logger = InitLogger() -func InitLogger() { - Logger = logrus.New() +func InitLogger() *logrus.Logger { + logger := logrus.New() // Set the desired log level (e.g., Debug, Info, Warn, Error, etc.) - Logger.SetLevel(logrus.InfoLevel) + logger.SetLevel(logrus.InfoLevel) // You can also set the log output (e.g., os.Stdout, a file, etc.) - Logger.SetOutput(os.Stdout) + logger.SetOutput(os.Stdout) + return logger }