From ec4c10341f9f4fb9e2cb5b85a97de252f5743b6b Mon Sep 17 00:00:00 2001 From: puddingfactory Date: Sat, 10 Dec 2016 15:53:44 -0600 Subject: [PATCH] Update comments for easier reading in godocs --- README.md | 2 +- logentrus.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bc443c8..8c44755 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Logentrus | a [Logentries](https://logentries.com) hook for [Logrus](https://github.com/sirupsen/logrus) :walrus: +# Logentrus | a [Logentries](https://logentries.com) hook for [Logrus](https://github.com/sirupsen/logrus) :walrus: [![GoDoc](https://godoc.org/github.com/puddingfactory/logentrus?status.svg)](https://godoc.org/github.com/puddingfactory/logentrus) *Logrus created by [Simon Eskildsen](http://sirupsen.com)* # Install diff --git a/logentrus.go b/logentrus.go index d38468b..e9dba20 100644 --- a/logentrus.go +++ b/logentrus.go @@ -1,3 +1,5 @@ +// Package logentrus acts as a Logentries (https://logentries.com) hook +// for Logrus (https://github.com/sirupsen/logrus) package logentrus import ( @@ -23,9 +25,7 @@ const ( port = 443 ) -// New creates and returns a new hook to an instance of logger. -// `hook, err := New("2bfbea1e-10c3-4419-bdad-7e6435882e1f", "Jan 2 15:04:05", logrus.InfoLevel, nil)` -// `if err == nil { log.Hooks.Add(hook) }` +// New creates and returns a new hook for use in Logrus func New(token, timestampFormat string, priority logrus.Level, config *tls.Config) (*Hook, error) { if token == "" { return nil, fmt.Errorf("Unable to create new LogentriesHook since a Token is required") @@ -42,7 +42,7 @@ func New(token, timestampFormat string, priority logrus.Level, config *tls.Confi return hook, err } -// Fire sends entry to Logentries +// Fire formats and sends JSON entry to Logentries service func (hook *Hook) Fire(entry *logrus.Entry) error { line, err := hook.format(entry) if err != nil { @@ -69,7 +69,7 @@ func (hook Hook) format(entry *logrus.Entry) (string, error) { return str, nil } -// Levels returns the log levels supported by LogentriesHook +// Levels returns the log levels supported by this hook func (hook *Hook) Levels() []logrus.Level { return logrus.AllLevels }