serverpod_logger_plus 0.4.0
serverpod_logger_plus: ^0.4.0 copied to clipboard
Plug-and-play structured logging for Serverpod: dual-routes each log to Serverpod Insights and structured JSON on stdout for GCP, Datadog, Elastic, and more.
0.4.0 #
- New
session.bindLogger(labels:, payload:)that enrichessession.loggerin place, so every latersession.loggercall on that session carries the bound context without threading a logger through your call stack. - Automatic request logging: pass
logRequests: truetoServerpodLoggerPlus.configure(or callsession.logger.logRequestOnClose()per request) to emit one structuredRequest completedrecord (endpoint, method, duration) to yourLogWriterwhen a session closes. - Distributed trace context: pass
bindTraceContext: trueandsession.loggerreads the incoming request's trace headers and bindstraceId/spanIdon every log call. Recognizes W3Ctraceparent, GCPX-Cloud-Trace-Context, AWSX-Amzn-Trace-Id, and Datadogx-datadog-trace-id/x-datadog-parent-id. ExposesextractTraceContext(session)and atraceContextExtractoroverride for proprietary headers. - Each writer now maps bound trace context into its provider's reserved trace
field (OTel native
traceId/spanId, ECS and New Relictrace.id/span.id, Datadogdd.trace_id/dd.span_id, GCPlogging.googleapis.com/trace).GcpJsonLogWritergains aprojectIdargument to format the reserved trace resource name for automatic log-to-trace linking. - Flushing for async writers: implement the new
FlushableLogWriterto drain in-flight work, and callServerpodLoggerPlus.flush()from your shutdown path beforepod.shutdown().MultiLogWriterfansflush()out to flushable children. - Breaking:
LogWriter.writegained optionaltraceId/spanIdnamed parameters. Custom writers that useimplements LogWritermust add them to theirwritesignature.
0.3.3 #
- Fix the broken CI badge in
README.mdon pub.dev (point it at the renamedtest.ymlworkflow).
0.3.2 #
- Align repository URLs in
pubspec.yaml,README.md, andCONTRIBUTING.mdwith the canonicalIanHeinrichGitHub owner casing.
0.3.1 #
- Add an
example/demonstrating every built-in writer plus thesession.loggerserver wiring. - Document all writer constructors.
- Shorten the pubspec
descriptionto pub.dev's recommended length.
0.3.0 #
- New
MultiLogWriterthat fans a single log call out to several writers, so you can keep a built-in structured-JSON writer and run extra work on top (e.g. an async network push) instead of having to replace the output entirely.
0.2.0 #
- New writers:
ElasticEcsLogWriter(Elastic Common Schema),NewRelicJsonLogWriter(New Relic Logs),SplunkJsonLogWriter(Splunk), andOtelJsonLogWriter(OpenTelemetry Logs / OTLP-JSON). - Breaking: replaced
CloudWatchJsonLogWriterwith the provider-neutralGenericJsonLogWriter, which emits the same flat JSON and now documents the full set of targets it fits (AWS CloudWatch, Azure Monitor / Container Insights, and any agent that indexes arbitrary stdout JSON). SwapCloudWatchJsonLogWriter()forGenericJsonLogWriter().
0.1.0 #
- Initial release.
LoggerPluscore Y-Splitter engine: dual-routes every log call toSession.log(Serverpod Insights) and a pluggableLogWriter(structured JSON / console output).- Zero-boilerplate
session.loggerextension getter, memoized per session, auto-selectingConsoleLogWriterin development and the configured production writer otherwise. - Built-in writers:
GcpJsonLogWriter,CloudWatchJsonLogWriter,DatadogJsonLogWriter,AxiomLogWriter,ConsoleLogWriter. ServerpodLoggerPlus.configurefor global production writer configuration.