Documentation ¶
Overview ¶
Package lambdalogger updates the global zap logger for use in a Lambda function.
Index ¶
- Constants
- Variables
- func ConfigureGlobal(ctx context.Context, initialFields map[string]interface{}) (*lambdacontext.LambdaContext, *zap.Logger)
- func Context(ctx context.Context, logger *zap.Logger) context.Context
- func FromContext(ctx context.Context) *zap.Logger
- func IsDebug(logger *zap.Logger) bool
- func Wrap(logger *zap.Logger, handler lambda.Handler) lambda.Handler
- type Config
Constants ¶
View Source
const ( FieldRequestID = "requestId" FieldApplication = "application" FieldNamespace = "namespace" FieldComponent = "component" )
Well-known fields
View Source
const Application = "panther" // tag all logs with "application" -> "panther" (used for audit)
Variables ¶
View Source
var DebugEnabled = strings.ToLower(os.Getenv("DEBUG")) == "true"
DebugEnabled is true if the DEBUG environment variable is set to true.
Functions ¶
func ConfigureGlobal ¶
func ConfigureGlobal( ctx context.Context, initialFields map[string]interface{}, ) (*lambdacontext.LambdaContext, *zap.Logger)
ConfigureGlobal adds the Lambda request ID to the global zap logger.
To add fields to every log message, include them in initialFields (the requestID is added for you).
Returns parsed Lambda context, global zap logger.
Types ¶
type Config ¶ added in v1.8.0
func (*Config) InitialFields ¶ added in v1.8.0
Click to show internal directories.
Click to hide internal directories.