Forward logs from your existing logger to Tracelit. Every log record is automatically correlated to its trace via trace_id and span_id — no changes to your logging code.
Use this file to discover all available pages before exploring further.
Tracelit bridges your existing logger to the OpenTelemetry log pipeline. Your current log setup keeps working exactly as before — Tracelit just adds a second destination and automatically injects trace_id and span_id from the active span context.
When a log is emitted inside an active span, the SDK reads the trace and span IDs from the current context and attaches them to the log record before export. In the Tracelit dashboard, every log entry links directly to its parent trace — no manual field mapping needed.
import ( "log/slog" "github.com/tracelit-ai/tracelit-go/bridge")slog.SetDefault(slog.New(bridge.NewSlogHandler()))// Pass ctx to correlate logs with the active spanslog.InfoContext(ctx, "order created", "order_id", order.ID)
When Rails is present, Tracelit.start! registers a broadcast target on Rails.logger. Every log is forwarded to Tracelit with trace correlation automatically injected.
# No changes needed — this already works after SDK setupRails.logger.info("Order #{order.id} created", { amount: order.total })# ↑ Tracelit adds trace_id + span_id automatically
Original logger output is preserved. The broadcast target runs alongside your existing log destinations.
When AddTracelit() is registered, all ILogger output is forwarded to Tracelit via OTLP. No changes to your existing logger code or DI setup.
public class OrdersService{ private readonly ILogger<OrdersService> _logger; public OrdersService(ILogger<OrdersService> logger) { _logger = logger; } public async Task<Order> CreateAsync(CreateOrderRequest req) { // trace_id + span_id from the current Activity are injected automatically _logger.LogInformation("Processing order for {Channel}", req.Channel); var order = await _repository.InsertAsync(req); _logger.LogInformation("Order {OrderId} created", order.Id); return order; }}