OtlpLogger.ts
OtlpLogger.ts overview
Section titled “OtlpLogger.ts overview”Exports Effect log entries over OTLP/HTTP.
The logger turns Effect log entries into OTLP log records and sends them to a logs endpoint, such as an OpenTelemetry Collector or vendor OTLP endpoint. It includes log levels, messages, annotations, causes, fiber ids, optional log spans, and current trace/span ids when they are present.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”constructors
Section titled “constructors”Creates an Effect Logger that exports log records through OTLP.
Details
The logger serializes records with the configured resource, sends them
through the OTLP exporter, and requires Scope so pending records can be
flushed on shutdown.
Signature
declare const make: (options: { readonly url: string readonly resource?: | { readonly serviceName?: string | undefined readonly serviceVersion?: string | undefined readonly attributes?: Record<string, unknown> } | undefined readonly headers?: Headers.Input | undefined readonly exportInterval?: Duration.Input | undefined readonly maxBatchSize?: number | undefined readonly shutdownTimeout?: Duration.Input | undefined readonly excludeLogSpans?: boolean | undefined}) => Effect.Effect<Logger.Logger<unknown, void>, never, OtlpSerialization | HttpClient.HttpClient | Scope.Scope>Since v4.0.0
layers
Section titled “layers”Layer that installs the OTLP logger created by make.
Details
By default the OTLP logger is merged with any existing loggers.
Signature
declare const layer: (options: { readonly url: string readonly resource?: | { readonly serviceName?: string | undefined readonly serviceVersion?: string | undefined readonly attributes?: Record<string, unknown> } | undefined readonly headers?: Headers.Input | undefined readonly exportInterval?: Duration.Input | undefined readonly maxBatchSize?: number | undefined readonly shutdownTimeout?: Duration.Input | undefined readonly excludeLogSpans?: boolean | undefined readonly mergeWithExisting?: boolean | undefined}) => Layer.Layer<never, never, HttpClient.HttpClient | OtlpSerialization>Since v4.0.0
layerFromConfig
Section titled “layerFromConfig”Creates an OTLP logs layer from OpenTelemetry configuration.
Signature
declare const layerFromConfig: (options?: { readonly resource?: | { readonly serviceName?: string | undefined readonly serviceVersion?: string | undefined readonly attributes?: Record<string, unknown> } | undefined readonly headers?: Headers.Input | undefined readonly excludeLogSpans?: boolean | undefined readonly mergeWithExisting?: boolean | undefined}) => Layer.Layer<never, never, HttpClient.HttpClient | OtlpSerialization>Since v4.0.0
models
Section titled “models”LogsData (interface)
Section titled “LogsData (interface)”OTLP logs payload serialized by OtlpLogger.
Signature
export interface LogsData { resourceLogs: ReadonlyArray<IResourceLogs>}Since v4.0.0