Categorygithub.com/justDMNK/logrus-stackdriver-formatter

# README

Logrus Stackdriver Formatter

Formatter for logrus which uses gofiber for the httpRequest instead of the default net/http Request, allowing log entries to be recognized by the fluentd Stackdriver agent on Google Cloud Platform.

Example:

package main

import (
	"github.com/gofiber/fiber/v2"
	log "github.com/sirupsen/logrus"
	logForm "github.com/justDMNK/logrus-stackdriver-formatter"
	"time"
)

func main() {
	log.SetFormatter(logForm.NewFormatter())
	log.Info("hello world!")

	// log a HTTP request in your handler
	log.WithField("httpRequest", &logForm.HTTPRequest{
		Request:      ctx,
		Status:       fiber.StatusOK,
		ResponseSize: 31337,
		Latency:      123 * time.Millisecond,
	}).Info("additional info")
}

Original

# Functions

No description provided by the author
NewFormatter with optional options.
No description provided by the author
StackdriverFormat maps values to be recognized by the Google Cloud Platform.

# Variables

DefaultFormat is Stackdriver.

# Structs

Formatter that is called on by logrus.
HTTPRequest contains an http.Request as well as additional information about the request and its response.

# Type aliases

Format configuration of the logrus formatter output.