mozlogrus

package module
Version: v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2017 License: MPL-2.0 Imports: 6 Imported by: 15

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

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

Jump to

Keyboard shortcuts

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