fix: correct LoggerFileBackend API usage to fix Oban startup

The previous commit (90e8964) introduced an incorrect LoggerBackends.add/2
call that prevented Oban from starting, causing all discovery jobs to remain
stuck in "available" state without being processed.

Root cause: LoggerBackends.add expects a tuple {module, id} as the first
argument, not the module alone with configuration options.

Fix: Use the correct API pattern:
1. Add backend with tuple identifier: {LoggerFileBackend, :file_log}
2. Configure separately with Logger.configure_backend/2

This resolves device discovery being completely broken - all background
jobs (discovery, polling, monitoring) now process correctly.
This commit is contained in:
Graham McIntire 2026-02-08 11:07:45 -06:00
parent 96c0254ab6
commit 16b833d077
No known key found for this signature in database

View file

@ -225,7 +225,11 @@ defmodule Towerops.Application do
# Register file logger backend for development (only available in :dev environment)
defp register_file_logger do
if Code.ensure_loaded?(LoggerBackends) do
LoggerBackends.add(LoggerFileBackend,
# Add the backend with a unique identifier
LoggerBackends.add({LoggerFileBackend, :file_log})
# Configure the backend with path and level
Logger.configure_backend({LoggerFileBackend, :file_log},
path: "_build/dev.log",
level: :debug
)