Documentation
¶
Index ¶
- type Option
- func DisableMetricsLogging() Option
- func DisableRequestDebugLogging() Option
- func DisableResponseDebugLogging() Option
- func DisableSetUpGlobalLoggerPerRequest() Option
- func DisableSetUpZeroLogGlobalLevel() Option
- func WithHandlerOptions(options ...lambda.Option) Option
- func WithLoggerProvider(loggerProvider func(ctx context.Context) *zerolog.Logger) Option
- type Options
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 ¶
WithHandlerOptions allows additional options to be passed into the underlying Lambda runtime. See lambda.StartWithOptions.
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.