# `DalaDev.Server.LogFilter`
[🔗](https://github.com/manhvu/dala_dev/blob/main/lib/dala_dev/server/log_filter.ex#L1)

Pure filter functions for the log stream. Extracted here so they can be
unit-tested without mounting a LiveView.

# `filter`

```elixir
@type filter() :: :all | :app | String.t()
```

# `line`

```elixir
@type line() :: map()
```

# `apply`

```elixir
@spec apply([line()], filter(), String.t()) :: [line()]
```

Filters a list of log lines by device/category filter, then by text.

`filter` is `:all`, `:app`, or a device serial string.
`text` is a comma-separated list of search terms (empty string = no filter).
Lines newest-first; order is preserved.

# `by_device`

```elixir
@spec by_device([line()], filter()) :: [line()]
```

# `by_device?`

```elixir
@spec by_device?(line(), filter()) :: boolean()
```

# `by_text`

```elixir
@spec by_text([line()], String.t()) :: [line()]
```

# `by_text?`

```elixir
@spec by_text?(line(), String.t()) :: boolean()
```

# `matches?`

```elixir
@spec matches?(line(), filter(), String.t()) :: boolean()
```

Returns true if the line passes both the device filter and the text filter.

---

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