@@ -34,15 +34,12 @@ import (
3434 "google.golang.org/grpc"
3535)
3636
37- var (
38- daemonize bool
39- debug bool
40- debugFile string
41- debugFilters []string
42- )
43-
4437// NewCommand created a new `daemon` command
4538func NewCommand (srv rpc.ArduinoCoreServiceServer , settings * rpc.Configuration ) * cobra.Command {
39+ var daemonize bool
40+ var debug bool
41+ var debugFile string
42+ var debugFiltersArg []string
4643 var daemonPort string
4744 daemonCommand := & cobra.Command {
4845 Use : "daemon" ,
@@ -65,7 +62,7 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *
6562 }
6663 },
6764 Run : func (cmd * cobra.Command , args []string ) {
68- runDaemonCommand (srv , daemonPort )
65+ runDaemonCommand (srv , daemonPort , debugFile , debug , daemonize , debugFiltersArg )
6966 },
7067 }
7168 defaultDaemonPort := settings .GetDaemon ().GetPort ()
@@ -82,13 +79,13 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *
8279 daemonCommand .Flags ().StringVar (& debugFile ,
8380 "debug-file" , "" ,
8481 i18n .Tr ("Append debug logging to the specified file" ))
85- daemonCommand .Flags ().StringSliceVar (& debugFilters ,
82+ daemonCommand .Flags ().StringSliceVar (& debugFiltersArg ,
8683 "debug-filter" , []string {},
8784 i18n .Tr ("Display only the provided gRPC calls" ))
8885 return daemonCommand
8986}
9087
91- func runDaemonCommand (srv rpc.ArduinoCoreServiceServer , daemonPort string ) {
88+ func runDaemonCommand (srv rpc.ArduinoCoreServiceServer , daemonPort , debugFile string , debug , daemonize bool , debugFiltersArg [] string ) {
9289 logrus .Info ("Executing `arduino-cli daemon`" )
9390
9491 gRPCOptions := []grpc.ServerOption {}
@@ -113,6 +110,7 @@ func runDaemonCommand(srv rpc.ArduinoCoreServiceServer, daemonPort string) {
113110 debugStdOut = out
114111 }
115112 }
113+ debugFilters = debugFiltersArg
116114 gRPCOptions = append (gRPCOptions ,
117115 grpc .UnaryInterceptor (unaryLoggerInterceptor ),
118116 grpc .StreamInterceptor (streamLoggerInterceptor ),
0 commit comments