Skip to content

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")
}

@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