verulon / monolog-handler
Monolog handler that ships log records to Verulon's application log ingestion endpoint.
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.0
- monolog/monolog: ^3.0
Requires (Dev)
- mockery/mockery: ^1.6
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A Monolog handler that ships log records to a Verulon application's log ingestion endpoint. Find the application UUID and token on the application's Logging tab in the Verulon dashboard.
Installation
composer require verulon/monolog-handler
Usage (Laravel)
Add a verulon channel to config/logging.php:
'verulon' => [ 'driver' => 'monolog', 'handler' => \Verulon\Monolog\VerulonHandler::class, 'handler_with' => [ 'applicationUuid' => env('VERULON_APPLICATION_UUID'), 'token' => env('VERULON_LOGGING_TOKEN'), ], 'level' => 'debug', ],
Add the application UUID and token to .env:
VERULON_APPLICATION_UUID=...
VERULON_LOGGING_TOKEN=...
Both are found on the application's Logging tab in the Verulon dashboard.
Then activate the channel by adding verulon to your LOG_STACK, or set it directly:
LOG_CHANNEL=verulon
or, as part of a stack:
LOG_STACK=single,verulon
Usage (framework-agnostic)
use Verulon\Monolog\VerulonHandler; use Monolog\Logger; $handler = new VerulonHandler( applicationUuid: 'your-application-uuid', token: 'your-token', ); $logger = new Logger('app'); $logger->pushHandler($handler); $logger->info('Hello, Verulon!');
Batching
This handler sends one HTTP request per log record. If you want to batch multiple records into
fewer requests, wrap it in Monolog's built-in BufferHandler:
use Monolog\Handler\BufferHandler; use Verulon\Monolog\VerulonHandler; $handler = new BufferHandler(new VerulonHandler($applicationUuid, $token));
Failure behavior
Log shipping must never break the application producing the logs. Any failure — network error, timeout, non-2xx response — is swallowed silently by the handler.