From 65399c1545cd9d8440e7b09e24266c80601914a4 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Mon, 20 Jan 2025 18:08:17 +0000 Subject: [PATCH] add logging to process_tpps.go and update SilenceUsage to false for processTPPSCommand --- cmd/milmove-tasks/main.go | 2 +- cmd/milmove-tasks/process_tpps.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/milmove-tasks/main.go b/cmd/milmove-tasks/main.go index 7953e4e04d6..083f8e31783 100644 --- a/cmd/milmove-tasks/main.go +++ b/cmd/milmove-tasks/main.go @@ -82,7 +82,7 @@ func main() { Short: "process TPPS files asynchrounously", Long: "process TPPS files asynchrounously", RunE: processTPPS, - SilenceUsage: true, + SilenceUsage: false, } initProcessTPPSFlags(processTPPSCommand.Flags()) root.AddCommand(processTPPSCommand) diff --git a/cmd/milmove-tasks/process_tpps.go b/cmd/milmove-tasks/process_tpps.go index 0d01d3aae99..b61b2394e72 100644 --- a/cmd/milmove-tasks/process_tpps.go +++ b/cmd/milmove-tasks/process_tpps.go @@ -62,6 +62,7 @@ func initProcessTPPSFlags(flag *pflag.FlagSet) { } func processTPPS(_ *cobra.Command, _ []string) error { + v := viper.New() logger, _, err := logging.Config( @@ -72,6 +73,9 @@ func processTPPS(_ *cobra.Command, _ []string) error { if err != nil { logger.Fatal("Failed to initialized Zap logging for process-tpps") } + + logger.Info("Reaching process_tpps.go line 78") + zap.ReplaceGlobals(logger) startTime := time.Now() @@ -147,7 +151,7 @@ func processTPPS(_ *cobra.Command, _ []string) error { previousDay := yesterday.Format("20220702") tppsFilename = fmt.Sprintf("MILMOVE-en%s.csv", previousDay) previousDayFormatted := yesterday.Format("July 02, 2022") - appCtx.Logger().Info(fmt.Sprintf("Starting transfer of TPPS data for %s: %s\n", previousDayFormatted, tppsFilename)) + logger.Info(fmt.Sprintf("Starting transfer of TPPS data for %s: %s\n", previousDayFormatted, tppsFilename)) } else { // if customFilePathToProcess != MILMOVE-enYYYYMMDD.csv (meaning we have given an ACTUAL specific filename we want processed instead of placeholder MILMOVE-enYYYYMMDD.csv) // then append customFilePathToProcess to the s3 bucket path and process that INSTEAD OF