From b718a3fc019f75fb175107329652d1db8a35a562 Mon Sep 17 00:00:00 2001 From: jloup Date: Wed, 16 May 2018 12:30:58 +0200 Subject: [PATCH] Attempt to log to systemd. --- Gopkg.lock | 14 +++++++++++++- Gopkg.toml | 4 ++++ cmd/app/main.go | 4 +++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 2a6ae4f..97bf5a5 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -41,6 +41,12 @@ revision = "3cfea5ab600ae37946be2b763b8ec2c1cf2d272d" version = "v1.0.0" +[[projects]] + name = "github.com/coreos/go-systemd" + packages = ["journal"] + revision = "39ca1b05acc7ad1220e09f133283b8859a8b71ab" + version = "v17" + [[projects]] branch = "master" name = "github.com/dchest/authcookie" @@ -221,6 +227,12 @@ revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab" version = "v1.1.1" +[[projects]] + branch = "pin_dependency" + name = "github.com/wercker/journalhook" + packages = ["."] + revision = "35950c648b44426a2590d4e316cdd409a53363ea" + [[projects]] branch = "master" name = "golang.org/x/crypto" @@ -285,6 +297,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "9df92ae3bbf81638f86228e1daacd75bd4f6d0afbfc449742e7f28fdefffdc46" + inputs-digest = "0bc4b06298ce7964140ac7d3e5e58915b01d6a53413af394501d5bf86683d9d7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 31e55bd..8e8c331 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -80,3 +80,7 @@ [[constraint]] name = "github.com/matcornic/hermes" version = "1.1.1" + +[[constraint]] + branch = "pin_dependency" + name = "github.com/wercker/journalhook" diff --git a/cmd/app/main.go b/cmd/app/main.go index 3f071de..d663e3d 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -12,6 +12,7 @@ import ( "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" "github.com/jloup/utils" + "github.com/wercker/journalhook" ) var log = utils.StandardL().WithField("module", "api") @@ -60,6 +61,7 @@ func init() { panic(err) } + journalhook.Enable() api.SetConfig(C.Api.Config) api.SetMailConfig(C.Mail) @@ -115,7 +117,7 @@ func main() { engine.Use(gin.Recovery()) - if C.Mode == "production" { + if C.Mode == "prod" { engine.Use(api.Logger()) apiGroup.Use(api.Logger()) } else { -- 2.41.0