Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Support for JSON output format #11

Open
ervilis opened this issue Aug 1, 2017 · 0 comments
Open

Support for JSON output format #11

ervilis opened this issue Aug 1, 2017 · 0 comments

Comments

@ervilis
Copy link
Contributor

ervilis commented Aug 1, 2017

Sometimes we need to use JSON format logs for some reasons. In my case I want to use it because I use Filebeat together with Logstash, so I can see the logs on Kibana.

My ideia is implement something like this:

import (
	"github.com/nuveo/log"
}

type MyStruct struct {
	// ...
}

func init {
	log.OutputFormat = log.JSONOutputFormat
}

func main {
	log.Debugln(MyStruct{...})
}

Result

{
	"datetime": "2017-08-01T00:00:00.0000",
	"data": {
		"MyStruct here"
	}
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants