ExampleNewLogHandler_withOptions demonstrates NewLogHandler with additional fields. Use WithFunctionARN() and WithTenantID() to include extra context.
()
| 38 | // ExampleNewLogHandler_withOptions demonstrates NewLogHandler with additional fields. |
| 39 | // Use WithFunctionARN() and WithTenantID() to include extra context. |
| 40 | func ExampleNewLogHandler_withOptions() { |
| 41 | // Set up handler with function ARN and tenant ID fields |
| 42 | slog.SetDefault(slog.New(lambdacontext.NewLogHandler( |
| 43 | lambdacontext.WithFunctionARN(), |
| 44 | lambdacontext.WithTenantID(), |
| 45 | ))) |
| 46 | |
| 47 | lambda.Start(func(ctx context.Context) (string, error) { |
| 48 | slog.InfoContext(ctx, "multi-tenant request", "tenant", "acme-corp") |
| 49 | return "success", nil |
| 50 | }) |
| 51 | } |
| 52 | |
| 53 | // ExampleWithFunctionARN demonstrates using WithFunctionARN to include the function ARN. |
| 54 | func ExampleWithFunctionARN() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…