OtlpLogger
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.
Constructors
Signature
declare const make: (options: {
readonly excludeLogSpans?: boolean;
readonly exportInterval?: Duration.Input;
readonly headers?: Headers.Input;
readonly maxBatchSize?: number;
readonly resource?: {
readonly attributes?: Record<string, unknown>;
readonly serviceName?: string;
readonly serviceVersion?: string;
};
readonly shutdownTimeout?: Duration.Input;
readonly url: string;
}) => Effect.Effect<
Logger.Logger<unknown, void>,
never,
Exporter.Flusher | OtlpSerialization | HttpClient.HttpClient | Scope.Scope
>;Layers
Layer that installs the OTLP logger created by make.
Details
By default the OTLP logger is merged with any existing loggers.
Signature
declare function layer(options: {
readonly excludeLogSpans?: boolean;
readonly exportInterval?: Input;
readonly headers?: Input;
readonly maxBatchSize?: number;
readonly mergeWithExisting?: boolean;
readonly resource?: {
readonly attributes?: Record<string, unknown>;
readonly serviceName?: string;
readonly serviceVersion?: string;
};
readonly shutdownTimeout?: Input;
readonly url: string;
}): Layer<Flusher, never, HttpClient | OtlpSerialization>;layerFromConfig
Added in v4.0.0
Source
Creates an OTLP logs layer from OpenTelemetry configuration.
Signature
declare function layerFromConfig(options?: {
readonly excludeLogSpans?: boolean;
readonly headers?: Input;
readonly mergeWithExisting?: boolean;
readonly resource?: {
readonly attributes?: Record<string, unknown>;
readonly serviceName?: string;
readonly serviceVersion?: string;
};
}): Layer<Flusher, never, HttpClient | OtlpSerialization>;
Creates an Effect
Loggerthat exports log records through OTLP.Details
The logger serializes records with the configured resource, sends them through the OTLP exporter, and requires
Scopeso pending records can be flushed on shutdown.