Documentation
¶
Index ¶
- Variables
- func Extract(ctx *lambdacontext.LambdaContext, field LambdaField) string
- type ContextValuer
- type LambdaField
- type LambdaLogContext
- func (lc *LambdaLogContext) ContextValue(ctx *lambdacontext.LambdaContext, f LambdaField) string
- func (lc *LambdaLogContext) ContextValues(ctx context.Context) []zapcore.Field
- func (lc *LambdaLogContext) NonContextValues() []zapcore.Field
- func (lc *LambdaLogContext) With(fields ...LambdaField) *LambdaLogContext
- func (lc *LambdaLogContext) WithAll() *LambdaLogContext
- func (lc *LambdaLogContext) WithBasic() *LambdaLogContext
- func (lc *LambdaLogContext) WithCustom(names ...string) *LambdaLogContext
- func (lc *LambdaLogContext) WithEnv(names ...string) *LambdaLogContext
- func (lc *LambdaLogContext) WithOptions(opts ...Option) *LambdaLogContext
- type Option
Constants ¶
This section is empty.
Variables ¶
var DefaultNames = []string{ AwsRequestID: "requestId", FunctionName: "functionName", FunctionVersion: "functionVersion", LogGroupName: "logGroupName", LogStreamName: "logStreamName", InvokeFunctionArn: "arn", CognitoIdentityID: "cognitoIdentityId", CognitoIdentityPoolID: "cognitoIdentityPoolId", InstallationID: "installationId", AppTitle: "appTitle", AppVersionCode: "appVersionCode", AppPackageName: "appPackageName", MemoryLimitInMB: "memoryLimitInMB", }
DefaultNames of fields
Functions ¶
func Extract ¶
func Extract(ctx *lambdacontext.LambdaContext, field LambdaField) string
Extract a field from lambda context
Types ¶
type ContextValuer ¶
type ContextValuer interface {
ContextValue(ctx *lambdacontext.LambdaContext, f LambdaField) (string, error)
}
ContextValuer Control how you get the value from a field and context
type LambdaField ¶
type LambdaField int
LambdaField type alias
const ( AwsRequestID LambdaField = iota CognitoIdentityID CognitoIdentityPoolID InstallationID AppTitle AppVersionCode AppPackageName InvokeFunctionArn FunctionName FunctionVersion LogGroupName LogStreamName MemoryLimitInMB END )
Enums for fields
type LambdaLogContext ¶
type LambdaLogContext struct {
// contains filtered or unexported fields
}
LambdaLogContext structure
func (*LambdaLogContext) ContextValue ¶
func (lc *LambdaLogContext) ContextValue(ctx *lambdacontext.LambdaContext, f LambdaField) string
ContextValue get the context value for a field
func (*LambdaLogContext) ContextValues ¶
func (lc *LambdaLogContext) ContextValues(ctx context.Context) []zapcore.Field
ContextValues for the lambda context.
func (*LambdaLogContext) NonContextValues ¶
func (lc *LambdaLogContext) NonContextValues() []zapcore.Field
NonContextValues e.g. lambdacontext.FunctionName or os.Getenv
func (*LambdaLogContext) With ¶
func (lc *LambdaLogContext) With(fields ...LambdaField) *LambdaLogContext
With Add these fields to context Add static fields if processNonContextValues is true
func (*LambdaLogContext) WithAll ¶
func (lc *LambdaLogContext) WithAll() *LambdaLogContext
WithAll Add all fields to logging context See ...
func (*LambdaLogContext) WithBasic ¶
func (lc *LambdaLogContext) WithBasic() *LambdaLogContext
WithBasic Add basic logging context See ...
func (*LambdaLogContext) WithCustom ¶
func (lc *LambdaLogContext) WithCustom(names ...string) *LambdaLogContext
WithCustom Add names from lambdacontext.ClientContext.Custom
func (*LambdaLogContext) WithEnv ¶
func (lc *LambdaLogContext) WithEnv(names ...string) *LambdaLogContext
WithEnv Add Env from os.Getenv
func (*LambdaLogContext) WithOptions ¶
func (lc *LambdaLogContext) WithOptions(opts ...Option) *LambdaLogContext
WithOptions add these options to the context.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
An Option configures a Logger.
func CustomValues ¶
func CustomValues(c ContextValuer) Option
CustomValues override context values. if you return an error the default ContextValue will be used.
func ProcessNonContextFields ¶
ProcessNonContextFields when calling ContextValues include or not include Values that are not part of the lambda context