Skip to content

Commit

Permalink
separate server run and stdin consumption for logdy cmd without any…
Browse files Browse the repository at this point in the history
… args
  • Loading branch information
Piotr committed Dec 13, 2024
1 parent 22a0c85 commit c6b2b89
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,19 @@ 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)")
go modes.ConsumeStdin(http.Ch)
startWebServer(cmd)
}
},
PersistentPreRun: func(cmd *cobra.Command, args []string) {
parseConfig(cmd)

verbose, _ := cmd.Flags().GetBool("verbose")
utils.SetLoggerLevel(verbose)
},
}

var listenStdCmd = &cobra.Command{
Expand Down

0 comments on commit c6b2b89

Please sign in to comment.