Example #1
0
	Panicln(args ...interface{})
	Print(args ...interface{})
	Printf(format string, args ...interface{})
	Println(args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Warning(args ...interface{})
	Warningf(format string, args ...interface{})
	Warningln(args ...interface{})
	Warnln(args ...interface{})
	WithField(key string, value interface{}) *logrus.Entry
	WithFields(fields logrus.Fields) *logrus.Entry
}

var (
	logger = &loggerProxy{logrus.New()}
)

// StandardLogger returns default logger
func StandardLogger() Logger {
	return logger
}

// Logger type
type loggerProxy struct {
	*logrus.Logger
}

// WithField creates an entry from the standard logger and adds a field to
// it. If you want multiple fields, use `WithFields`.
//
Example #2
0
package main

import (
	"github.com/nildev/account/Godeps/_workspace/src/github.com/Sirupsen/logrus"
	"github.com/nildev/account/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/airbrake"
)

var log = logrus.New()

func init() {
	log.Formatter = new(logrus.TextFormatter) // default
	log.Hooks.Add(new(logrus_airbrake.AirbrakeHook))
}

func main() {
	airbrake.Endpoint = "https://exceptions.whatever.com/notifier_api/v2/notices.xml"
	airbrake.ApiKey = "whatever"
	airbrake.Environment = "production"

	log.WithFields(logrus.Fields{
		"animal": "walrus",
		"size":   10,
	}).Info("A group of walrus emerges from the ocean")

	log.WithFields(logrus.Fields{
		"omg":    true,
		"number": 122,
	}).Warn("The group's number increased tremendously!")

	log.WithFields(logrus.Fields{
		"omg":    true,