Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #68 from remyLemeunier/fix_journal
Browse files Browse the repository at this point in the history
Enable log to journal only when possible
  • Loading branch information
obiesmans authored Oct 11, 2017
2 parents 0a6ad83 + 0160ca3 commit 1d57902
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import (

"runtime/debug"

"github.com/coreos/go-systemd/journal"
"github.com/remyLemeunier/contactkey/commands"
log "github.com/sirupsen/logrus"
"github.com/wercker/journalhook"
)

func main() {
log.AddHook(&journalhook.JournalHook{})
if journal.Enabled() {
log.AddHook(&journalhook.JournalHook{})
}

defer func() {
if r := recover(); r != nil {
log.WithFields(log.Fields{"stacktrace": string(debug.Stack())}).Error(fmt.Sprintf("Recovered from panic %q", r))
Expand Down

0 comments on commit 1d57902

Please sign in to comment.