v0.1.0-rc4 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2015 License: MIT, Apache-2.0 Imports: 5 Imported by: 0


Papertrail Hook for Logrus

Papertrail provides hosted log management. Once stored in Papertrail, you can group your logs on various dimensions, search them, and trigger alerts.

In most deployments, you'll want to send logs to Papertrail via their remote_syslog daemon, which requires no application-specific configuration. This hook is intended for relatively low-volume logging, likely in managed cloud hosting deployments where installing remote_syslog is not possible.


You can find your Papertrail UDP port on your Papertrail account page. Substitute it below for YOUR_PAPERTRAIL_UDP_PORT.

For YOUR_APP_NAME, substitute a short string that will readily identify your application or service in the logs.

import (

func main() {
  log       := logrus.New()
  hook, err := logrus_papertrail.NewPapertrailHook("logs.papertrailapp.com", YOUR_PAPERTRAIL_UDP_PORT, YOUR_APP_NAME)

  if err == nil {




This section is empty.


This section is empty.


This section is empty.


type PapertrailHook

type PapertrailHook struct {
	Host    string
	Port    int
	AppName string
	UDPConn net.Conn

PapertrailHook to send logs to a logging service compatible with the Papertrail API.

func NewPapertrailHook

func NewPapertrailHook(host string, port int, appName string) (*PapertrailHook, error)

NewPapertrailHook creates a hook to be added to an instance of logger.

func (*PapertrailHook) Fire

func (hook *PapertrailHook) Fire(entry *logrus.Entry) error

Fire is called when a log event is fired.

func (*PapertrailHook) Levels

func (hook *PapertrailHook) Levels() []logrus.Level

Levels returns the available logging levels.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL