# `ScoutApm.Logging.LogService`

Background GenServer that batches and sends log records to an OTLP collector.

Implements a queue with batching and a maximum queue size to prevent memory issues.
Follows the same pattern as ScoutApm.Error.ErrorService.

# `t`

```elixir
@type t() :: %ScoutApm.Logging.LogService{
  queue: :queue.queue(ScoutApm.Logging.LogRecord.t()),
  queue_size: non_neg_integer(),
  timer_ref: reference() | nil
}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `drain`

```elixir
@spec drain(timeout :: non_neg_integer()) :: :ok | :timeout
```

Waits for the queue to drain. Used in tests and shutdown.

# `enabled?`

```elixir
@spec enabled?() :: boolean()
```

Checks if logging is enabled.

# `flush`

```elixir
@spec flush() :: :ok
```

Forces an immediate flush of queued logs. Used in tests.

# `queue_size`

```elixir
@spec queue_size() :: non_neg_integer()
```

Returns the current queue size.

# `send`

```elixir
@spec send(ScoutApm.Logging.LogRecord.t()) :: :ok
```

Sends a log record to the service for batched delivery.
Non-blocking - returns immediately.

# `start_link`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
