Skip to content

Monolog Bridge

The Monolog bridge binds Psr\Log\LoggerInterface in the container using Monolog.

Terminal window
composer require fatjon-lleshi/antares-monolog-bridge

The bridge is auto-discovered — no manual registration needed.

Set these in your .env:

VariableDefaultDescription
LOG_CHANNELfilefile, stdout, or stderr
LOG_LEVELdebugAny PSR-3 level (debug, info, warning, error, …)
APP_NAMEantaresLogger channel name

When LOG_CHANNEL=file, logs are written to storage/logs/app.log with daily rotation (30-day retention).

Inject LoggerInterface anywhere in your application:

use Psr\Log\LoggerInterface;
class UserService
{
public function __construct(
private readonly LoggerInterface $logger,
) {}
public function create(CreateUserRequest $request): User
{
$user = User::create($request->toArray());
$this->logger->info('User created', ['id' => $user->id]);
return $user;
}
}