start

package
v0.0.0-...-3a9ac50 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func DisableMetricsLogging

func DisableMetricsLogging() Option

DisableMetricsLogging disables logging with metrics.Metrics.

func DisableRequestDebugLogging

func DisableRequestDebugLogging() Option

DisableRequestDebugLogging disables logging the JSON-encoded request in DEBUG (configsupport.IsDebug) mode.

func DisableResponseDebugLogging

func DisableResponseDebugLogging() Option

DisableResponseDebugLogging disables logging the JSON-encoded response in DEBUG (configsupport.IsDebug) mode.

func DisableSetUpGlobalLoggerPerRequest

func DisableSetUpGlobalLoggerPerRequest() Option

DisableSetUpGlobalLoggerPerRequest disables calling logsupport.SetUpGlobalLogger on every request.

func DisableSetUpZeroLogGlobalLevel

func DisableSetUpZeroLogGlobalLevel() Option

DisableSetUpZeroLogGlobalLevel disables calling logsupport.SetUpZeroLogGlobalLevel once on startup.

func WithHandlerOptions

func WithHandlerOptions(options ...lambda.Option) Option

WithHandlerOptions allows additional options to be passed into the underlying Lambda runtime. See lambda.StartWithOptions.

func WithLoggerProvider

func WithLoggerProvider(loggerProvider func(ctx context.Context) *zerolog.Logger) Option

WithLoggerProvider allows customisation of the logger and its context on every request.

type Options

type Options struct {
	// LoggerProvider provides a new zerolog.Logger instance on every request.
	LoggerProvider func(ctx context.Context) *zerolog.Logger

	// DisableRequestDebugLogging disables logging the JSON-encoded request in DEBUG mode.
	DisableRequestDebugLogging bool
	// DisableResponseDebugLogging disables logging the JSON-encoded response in DEBUG mode.
	DisableResponseDebugLogging bool

	// DisableMetricsLogging dictates whether the handler will automatically log metrics about the request
	// and response using metrics.Metrics.
	//
	// The metrics are written as structured JSON that contains basic information such as start and end time, status
	// codes, whether the handler returns an error or panics, etc. You can turn this feature off if you are doing your
	// own service logging.
	DisableMetricsLogging bool

	// DisableSetUpGlobalLogger dictates whether logsupport.SetUpGlobalLogger is called on every request.
	// logsupport.SetUpGlobalLogger sets up log.Default with reasonable flags as well as adding the request Id as
	// prefix. You should generally leave this feature enabled if you do a lot of logging with the default log module.
	DisableSetUpGlobalLogger bool

	// DisableSetUpZeroLogGlobalLevel dictates whether logsupport.SetUpZeroLogGlobalLevel is called once on startup.
	// logsupport.SetUpZeroLogGlobalLevel changes the global log level according to available environment variables.
	// It's very useful to leave enabled if you emit lot of logs at Debug level and would like to use the DEBUG
	// environment variable to toggle writing Debug logs.
	DisableSetUpZeroLogGlobalLevel bool

	// HandlerOptions passes along additional Lambda-runtime-specific options. See lambda.StartWithOptions.
	HandlerOptions []lambda.Option
}

Options provides a base struct for customisations to starting handler.

func New

func New(options []Option) *Options

New creates an initial Options and applies modifiers thereto.

Jump to

Keyboard shortcuts

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