Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#81: syslog handler #84

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

#81: syslog handler #84

wants to merge 3 commits into from

Conversation

nergdron
Copy link

@nergdron nergdron commented Jul 5, 2020

This is my first pass at implementing this handler. I wrote a quick little test script which seems to produce the behaviour I expect, but I welcome feedback on it.

package main

import (
  "errors"
  stdlog "log"
  "github.com/apex/log"
  "github.com/apex/log/handlers/syslog"
)

func main() {
  h, err := syslog.New("", 0, "test")
  if err != nil {
    stdlog.Fatal(err)
  }
  log.SetHandler(h)
  log.WithError(errors.New("errormsg")).WithFields(log.Fields{
		"app": "myapp",
		"env": "prod",
	}).Warn("something went wrong\nunfortunately")
}

handlers/syslog/syslog.go Outdated Show resolved Hide resolved
handlers/syslog/syslog.go Outdated Show resolved Hide resolved
@nergdron
Copy link
Author

@tj: ok, I think that works alright, how's this look to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants