5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-12-26 16:45:40 +00:00
matterbridge/vendor/github.com/apex/log
Wim 4dd8bae5c9
Update dependencies (#1610)
* Update dependencies

* Update module to go 1.17
2021-10-17 00:47:22 +02:00
..
.gitignore Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
context.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
default.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
doc.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
entry.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
History.md Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
interface.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
levels.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
LICENSE Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
logger.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
Makefile Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
pkg.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
Readme.md Update dependencies (#1610) 2021-10-17 00:47:22 +02:00
stack.go Update dependencies (#1610) 2021-10-17 00:47:22 +02:00

Structured logging for golang

Package log implements a simple structured logging API inspired by Logrus, designed with centralization in mind. Read more on Medium.

Handlers

  • apexlogs handler for Apex Logs
  • cli human-friendly CLI output
  • discard discards all logs
  • es  Elasticsearch handler
  • graylog Graylog handler
  • json  JSON output handler
  • kinesis AWS Kinesis handler
  • level  level filter handler
  • logfmt  logfmt plain-text formatter
  • memory in-memory handler for tests
  • multi fan-out to multiple handlers
  • papertrail Papertrail handler
  • text  human-friendly colored output
  • delta  outputs the delta between log calls and spinner

Example

Example using the Apex Logs handler.

package main

import (
	"errors"
	"time"

	"github.com/apex/log"
)

func main() {
	ctx := log.WithFields(log.Fields{
		"file": "something.png",
		"type": "image/png",
		"user": "tobi",
	})

	for range time.Tick(time.Millisecond * 200) {
		ctx.Info("upload")
		ctx.Info("upload complete")
		ctx.Warn("upload retry")
		ctx.WithError(errors.New("unauthorized")).Error("upload failed")
		ctx.Errorf("failed to upload %s", "img.png")
	}
}

Build Status GoDoc