allow JIRA_LOG_FORMAT env variable to control log output format

This commit is contained in:
Cory Bennett
2016-08-02 20:12:30 -07:00
parent 752a94d94b
commit 469def0296
+5 -1
View File
@@ -15,11 +15,15 @@ import (
var ( var (
log = logging.MustGetLogger("jira") log = logging.MustGetLogger("jira")
format = "%{color}%{time:2006-01-02T15:04:05.000Z07:00} %{level:-5s} [%{shortfile}]%{color:reset} %{message}" defaultFormat = "%{color}%{time:2006-01-02T15:04:05.000Z07:00} %{level:-5s} [%{shortfile}]%{color:reset} %{message}"
) )
func main() { func main() {
logBackend := logging.NewLogBackend(os.Stderr, "", 0) logBackend := logging.NewLogBackend(os.Stderr, "", 0)
format := os.Getenv("JIRA_LOG_FORMAT")
if format == "" {
format = defaultFormat
}
logging.SetBackend( logging.SetBackend(
logging.NewBackendFormatter( logging.NewBackendFormatter(
logBackend, logBackend,