From c6b2b893d4f3980c9f8636e511a9ecab7e591008 Mon Sep 17 00:00:00 2001 From: Piotr Date: Fri, 13 Dec 2024 09:22:38 +0100 Subject: [PATCH] separate server run and stdin consumption for `logdy` cmd without any args --- main.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 0bdff4b..06333d9 100644 --- a/main.go +++ b/main.go @@ -30,14 +30,6 @@ Break free from the terminal and stream your logs in any format to a web UI where you can filter and browse well formatted application output. `, Run: func(cmd *cobra.Command, args []string) { - }, - PersistentPreRun: func(cmd *cobra.Command, args []string) { - parseConfig(cmd) - - verbose, _ := cmd.Flags().GetBool("verbose") - utils.SetLoggerLevel(verbose) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { // by default, `stdin` mode will run if [command] is not provided if len(args) == 0 { utils.Logger.Info("Listen to stdin (from pipe)") @@ -45,6 +37,12 @@ where you can filter and browse well formatted application output. startWebServer(cmd) } }, + PersistentPreRun: func(cmd *cobra.Command, args []string) { + parseConfig(cmd) + + verbose, _ := cmd.Flags().GetBool("verbose") + utils.SetLoggerLevel(verbose) + }, } var listenStdCmd = &cobra.Command{