Semi working solution for glog flags
This commit is contained in:
parent
558b060130
commit
b94c5d4026
40
cmd/cmd.go
40
cmd/cmd.go
@ -1,6 +1,8 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
@ -87,6 +89,36 @@ var (
|
||||
EnvVar: "MICRO_TRANSPORT_ADDRESS",
|
||||
Usage: "Comma-separated list of transport addresses",
|
||||
},
|
||||
|
||||
// logging flags
|
||||
cli.BoolFlag{
|
||||
Name: "logtostderr",
|
||||
Usage: "log to standard error instead of files",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "alsologtostderr",
|
||||
Usage: "log to standard error as well as files",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "log_dir",
|
||||
Usage: "log files will be written to this directory instead of the default temporary directory",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "stderrthreshold",
|
||||
Usage: "logs at or above this threshold go to stderr",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "v",
|
||||
Usage: "log level for V logs",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "vmodule",
|
||||
Usage: "comma-separated list of pattern=N settings for file-filtered logging",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "log_backtrace_at",
|
||||
Usage: "when logging hits line file:N, emit a stack trace",
|
||||
},
|
||||
}
|
||||
|
||||
Brokers = map[string]func([]string, ...broker.Option) broker.Broker{
|
||||
@ -140,6 +172,14 @@ func Setup(c *cli.Context) error {
|
||||
)
|
||||
|
||||
client.DefaultClient = client.NewClient()
|
||||
flag.Set("logtostderr", fmt.Sprintf("%v", c.Bool("logtostderr")))
|
||||
flag.Set("alsologtostderr", fmt.Sprintf("%v", c.Bool("alsologtostderr")))
|
||||
flag.Set("stderrthreshold", c.String("stderrthreshold"))
|
||||
flag.Set("log_backtrace_at", c.String("log_backtrace_at"))
|
||||
flag.Set("log_dir", c.String("log_dir"))
|
||||
flag.Set("vmodule", c.String("vmodule"))
|
||||
flag.Set("v", c.String("v"))
|
||||
flag.Parse()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user