Switon's PSR-3 logger for application services that want automatic categories, structured context, per-category filtering, and low-setup defaults.
- Standard logger contract:
LoggerInterfaceis the main logging contract. - Automatic category routing: log categories can be derived from the caller.
- Structured context: placeholder interpolation and extra context stay structured.
- Output backends: stdout, file, syslog, and memory sinks are available.
- Category-aware filtering:
Loggerderives categories from the caller and applies per-category levels.
composer require switon/loguse Psr\Log\LoggerInterface;
use Switon\Core\Attribute\Autowired;
class UserService
{
#[Autowired] protected LoggerInterface $logger;
public function login(int $userId): void
{
$this->logger->info('User logged in', ['user_id' => $userId]);
}
}Docs: https://docs.switon.dev/latest/log
MIT.