Categorygithub.com/cccteam/logger
modulepackage
0.1.12
Repository: https://github.com/cccteam/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, AWS Logging, and Console Logging.

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

The ConsoleExporter is useful for local development and debugging.

The AWSExporter will also correlate logs to AWS X-Ray if you instrument your code with tracing and have logs sent to Cloudwatch. Note that additional configuration in the tracing is required to enable the correlation. In the tracing configuration, you must set the log group names to where the logs are being sent.

# Functions

Ctx returns the logger from the context.
NewAWSExporter returns a new AWSExporter.
NewConsoleExporter returns a configured ConsoleExporter.
NewCtx associates the logger with the context and returns the resulting context.
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

No description provided by the author
AWSExporter is an Exporter that logs to stdout in JSON format to be sent to cloudwatch.
ConsoleExporter implements exporting to the console.
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.