Skip to content

Logger always writes to os.Stderr #871

Closed
@adred

Description

@adred
package config

import (
	"os"

	"github.com/labstack/gommon/log"
)

// SetLoggerOutput sets the log path
func SetLoggerOutput(cfgLogPath string, debug string) error {
	if debug == "true" {
		log.SetOutput(os.Stderr)
		log.SetLevel(log.DEBUG)
	} else {
		logPath, err := os.OpenFile(cfgLogPath, os.O_APPEND|os.O_CREATE, 0755)
		if err != nil {
			return err
		}
		log.SetOutput(logPath)
		log.SetLevel(log.WARN)
	}
	return nil
}

Regardless of the value of debug it always writes to os.Stderr. I ditched Logrus for Echo's logger. Thanks for the awesome framework!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions