Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

mozlogrus GoDoc

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

Installation

go get go.mozilla.org/mozlogrus

Example

Basic 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
  }
}

Custom Log Types

func init() {
    mozlogrus.EnableFormatter(&mozlogrus.MozLogFormatter{
        LoggerName: "ApplicationName",
        Type: "udp datagram",
    })
}

About

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

Resources

License

Languages

You can’t perform that action at this time.