Add ability to disable logging output
This commit is contained in:
parent
d9d6cdca6d
commit
715eb86cec
3 changed files with 8 additions and 1 deletions
|
@ -258,6 +258,7 @@ func setup() {
|
|||
if opts.Logging.Output != "" {
|
||||
|
||||
chk := map[string]bool{
|
||||
"none": true,
|
||||
"stdout": true,
|
||||
"stderr": true,
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ var startCmd = &cobra.Command{
|
|||
Short: "Start the database and http server",
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
fmt.Print(logo)
|
||||
if opts.Logging.Output != "none" {
|
||||
fmt.Print(logo)
|
||||
}
|
||||
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
|
|
|
@ -18,6 +18,8 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -230,6 +232,8 @@ func (l *Logger) SetFormat(v string) {
|
|||
// SetOutput sets the logging output of the logger instance.
|
||||
func (l *Logger) SetOutput(v string) {
|
||||
switch v {
|
||||
case "none":
|
||||
l.Out = ioutil.Discard
|
||||
case "stdout":
|
||||
l.Out = os.Stdout
|
||||
case "stderr":
|
||||
|
|
Loading…
Reference in a new issue