README

mozlogrus GoDoc

A logging library which conforms to Mozilla's logging standard for logrus.

Example Usage

package main

import (
	log "github.com/Sirupsen/logrus"
	"go.mozilla.org/mozlogrus"
)

func init() {
	mozlogrus.Enable("ApplicationName")
}

func main() {
	log.WithFields(log.Fields{
		"animal": "walrus",
		"size":   10,
	}).Info("A group of walrus emerges from the ocean")
}
$ go run mozlogrus.go | jq
{
  "Timestamp": 1487349663973687600,
  "Time": "2017-02-17T16:41:03Z",
  "Type": "app.log",
  "Logger": "ApplicationName",
  "Hostname": "gator3",
  "EnvVersion": "2.0",
  "Pid": 18061,
  "Severity": 4,
  "Fields": {
    "animal": "walrus",
    "msg": "A group of walrus emerges from the ocean",
    "size": 10
  }
}
Expand ▾ Collapse ▴

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enable

func Enable(loggerName string)

    Enable enables mozlogrus

    func SetFormatterName

    func SetFormatterName(name string)

      SetFormatterName the LoggerName for the logrus formatter

      Types

      type MozLogFormatter

      type MozLogFormatter struct {
      	LoggerName string
      }

      func (*MozLogFormatter) Format

      func (m *MozLogFormatter) Format(entry *logrus.Entry) ([]byte, error)

      Source Files