mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-07 13:33:32 +02:00
allow JIRA_LOG_FORMAT env variable to control log output format
This commit is contained in:
+5
-1
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user