lambdalog

A Go logging library tuned for AWS Lambda: JSON output, request-ID correlation, adaptive sampling.

Files

namesizelast change
.editorconfig415 B
.github/FUNDING.yml210 B
.github/ISSUE_TEMPLATE/bug.md664 B
.github/pull_request_template.md706 B
.github/workflows/ci.yml1.5 KB
.golangci.yml0.6 KB
adapters/apigateway/v1/gateway_test.go2.0 KB
adapters/apigateway/v1/gateway.go2.9 KB
adapters/apigateway/v2/gateway_test.go1.9 KB
adapters/apigateway/v2/gateway.go2.6 KB
adapters/lambda/handler_test.go2.3 KB
adapters/lambda/handler.go3.0 KB
adapters/lambda/invoke.go2.4 KB
adapters/sns/subscriber.go2.1 KB
adapters/sqs/consumer_test.go2.1 KB
adapters/sqs/consumer.go2.8 KB
bench_test.go3.1 KB
bench/encoder_bench_test.go2.2 KB
bench/end_to_end_bench_test.go2.0 KB
bench/handler_bench_test.go1.8 KB
bench/sampler_bench_test.go1.6 KB
context_test.go1.6 KB
context.go2.1 KB
context/context_test.go2.1 KB
context/context.go2.6 KB
context/requestid/requestid_test.go2.0 KB
context/requestid/requestid.go2.4 KB
context/tracing/otel_test.go2.1 KB
context/tracing/otel.go2.8 KB
context/tracing/xray_test.go1.9 KB
context/tracing/xray.go3.0 KB
docs/cold-start.md6.2 KB
docs/design.md9.1 KB
encoder_test.go3.0 KB
encoder.go5.4 KB
example/handler.go1.7 KB
examples/basic/main.go1.3 KB
examples/rest-api/main.go1.5 KB
examples/sqs-consumer/main.go1.4 KB
examples/step-function/main.go1.5 KB
examples/with-tracing/main.go1.6 KB
fields_test.go2.9 KB
fields.go3.0 KB
go.mod0.2 KB
handler_test.go3.2 KB
handler.go4.1 KB
internal/encoder/encoder_test.go2.4 KB
internal/encoder/encoder.go3.2 KB
internal/encoder/format.go2.3 KB
internal/encoder/json/encoder_test.go3.1 KB
internal/encoder/json/encoder.go4.6 KB
internal/encoder/json/escape/html_test.go2.2 KB
internal/encoder/json/escape/html.go3.2 KB
internal/encoder/json/fast/buffer_test.go2.1 KB
internal/encoder/json/fast/buffer.go2.7 KB
internal/encoder/json/fast/strconv_test.go1.9 KB
internal/encoder/json/fast/strconv.go2.5 KB
internal/encoder/json/schema/schema_test.go2.6 KB
internal/encoder/json/schema/schema.go3.7 KB
internal/encoder/json/truncate/truncate_test.go2.3 KB
internal/encoder/json/truncate/truncate.go3.0 KB
internal/sampler/adaptive/adaptive_test.go2.3 KB
internal/sampler/adaptive/adaptive.go3.6 KB
internal/sampler/random/random_test.go1.9 KB
internal/sampler/random/random.go2.0 KB
internal/sampler/sampler.go1.9 KB
internal/sampler/threshold/threshold.go1.6 KB
internal/testdata/events/apigw-v2.json1.6 KB
internal/testdata/events/eventbridge.json0.9 KB
internal/testdata/events/sqs.json1.7 KB
lambdalog_test.go4.3 KB
lambdalog.go5.8 KB
level.go2.3 KB
LICENSE1.1 KB
Makefile0.8 KB
middleware/http/accesslog_test.go1.5 KB
middleware/http/accesslog.go2.3 KB
middleware/http/middleware_test.go1.7 KB
middleware/http/middleware.go2.0 KB
middleware/http/recovery_test.go1.6 KB
middleware/http/recovery.go1.8 KB
output/cloudwatch_test.go2.0 KB
output/cloudwatch.go2.6 KB
output/file_test.go1.8 KB
output/file.go2.6 KB
output/stdout.go1.9 KB
README.md2.9 KB
sampler.go2.8 KB
SECURITY.md1.3 KB

README

lambdalog is a small structured logging library I wrote after noticing that my Lambda functions were spending measurable CPU time on log formatting during burst traffic. It emits JSON, correlates by request ID, and can throttle high-volume log sites adaptively.

Recent commits

  • 8f5d11a sampler: reset window on cold start
  • 2c14b07 context: WithField deep-copies attribute map
  • d7a0b13 logger: emit ISO-8601 timestamps with nanoseconds
  • f3b8e55 bench: move table-driven tests to subtests
  • 9cc1270 sampler: adaptive rate based on recent QPS
  • 5a2dd68 context: extract request id from Lambda runtime
  • b146e02 logger: buffered writer to reduce stdout contention
  • 71ae9d4 v0.2.0 API freeze
  • 20c4e37 initial commit