Categorygithub.com/jtwatson/logger
modulepackage
0.1.1
Repository: https://github.com/jtwatson/logger.git
Documentation: pkg.go.dev

# README

logger

GoDoc

logger is an HTTP request logger that implements correlated logging to one of several supported platforms. Each HTTP request is logged as the parent log, with all logs generated during the request as child logs.

The Logging destination is configured with an Exporter. This package provides Exporters for Google Cloud Logging and Console Logging.

The GoogleCloudExporter will also correlate logs to Cloud Trace if you instrument your code with tracing.

# Functions

Ctx returns the logger from the context.
NewConsoleExporter returns a configured ConsoleExporter.
NewGoogleCloudExporter returns a configured GoogleCloudExporter.
NewRequestLogger returns a middleware that logs the request and injects a Logger into the context.
Req returns the logger from the http request.

# Structs

ConsoleExporter implements exporting to Google Cloud Logging.
GoogleCloudExporter implements exporting to Google Cloud Logging.
Logger implements logging methods for this package.

# Interfaces

Exporter is the interface for implementing a middleware to export logs to some destination.