Skip to content

Commit c6b2b89

Browse files
author
Piotr
committed
separate server run and stdin consumption for logdy cmd without any args
1 parent 22a0c85 commit c6b2b89

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

main.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,19 @@ Break free from the terminal and stream your logs in any format to a web UI
3030
where you can filter and browse well formatted application output.
3131
`,
3232
Run: func(cmd *cobra.Command, args []string) {
33-
},
34-
PersistentPreRun: func(cmd *cobra.Command, args []string) {
35-
parseConfig(cmd)
36-
37-
verbose, _ := cmd.Flags().GetBool("verbose")
38-
utils.SetLoggerLevel(verbose)
39-
},
40-
PersistentPostRun: func(cmd *cobra.Command, args []string) {
4133
// by default, `stdin` mode will run if [command] is not provided
4234
if len(args) == 0 {
4335
utils.Logger.Info("Listen to stdin (from pipe)")
4436
go modes.ConsumeStdin(http.Ch)
4537
startWebServer(cmd)
4638
}
4739
},
40+
PersistentPreRun: func(cmd *cobra.Command, args []string) {
41+
parseConfig(cmd)
42+
43+
verbose, _ := cmd.Flags().GetBool("verbose")
44+
utils.SetLoggerLevel(verbose)
45+
},
4846
}
4947

5048
var listenStdCmd = &cobra.Command{

0 commit comments

Comments
 (0)