Add ability to disable logging output

This commit is contained in:
Tobie Morgan Hitchcock 2017-02-22 01:40:24 +00:00
parent d9d6cdca6d
commit 715eb86cec
3 changed files with 8 additions and 1 deletions

View file

@ -258,6 +258,7 @@ func setup() {
if opts.Logging.Output != "" {
chk := map[string]bool{
"none": true,
"stdout": true,
"stderr": true,
}

View file

@ -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) {

View file

@ -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":