GithubHelp home page GithubHelp logo

braderz / logrus-papertrail-hook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from polds/logrus-papertrail-hook

0.0 2.0 0.0 16 KB

Papertrail hook for Logrus - https://github.com/sirupsen/logrus

License: MIT License

Go 100.00%

logrus-papertrail-hook's Introduction

Papertrail Hook for Logrus :walrus: Build Status godoc reference

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.

Usage

You can find your Papertrail port(Accepting TCP/TLS, UDP) on your Papertrail account page. Substitute it below for YOUR_PAPERTRAIL_PORT.

For YOUR_APP_NAME and YOUR_HOST_NAME, substitute a short strings that will readily identify your application and server in the logs. If you leave YOUR_HOST_NAME empty, papertrail will replace it with your ip.

import (
  log "github.com/sirupsen/logrus"
  "github.com/polds/logrus-papertrail-hook"
)

func main() {

  hook, err := logrus_papertrail.NewPapertrailHook(&logrus_papertrail.Hook{
    Host: "logs.papertrailapp.com",
    Port: YOUR_PAPERTRAIL_PORT,
    Hostname: YOUR_HOST_NAME,
    Appname: YOUR_APP_NAME
  })

  hook.SetLevels([]log.Level{log.ErrorLevel, log.WarnLevel})

  if err == nil {
    log.AddHook(hook)
  }

  log.Warning("Here is you message")

}

2017-04-13-16 32 29-screenshot

Changelog

logrus-papertrail-hook's People

Contributors

rossiar avatar tonglil avatar undiabler avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.