You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Like the title says ;-) channels already exist in monolog to break log messages into various segments - billing, security, main, etc.
I wrote a custom processor to add '#' plus the channel name to my mesages that get sent to Stackify, so I can search the logs easily using y'alls nice hashtag feature. But it really should just be a part of this handler, no?
This is my very simple processor BTW
// set up Monolog
use Monolog\Logger;
use Stackify\Log\Monolog\Handler as StackifyHandler;
use Stackify\Log\Transport\ExecTransport;
$stackify_transport = new ExecTransport( '--my api key--' );
$handler_stackify = new StackifyHandler( 'Main site', 'Production', $stackify_transport );
// Now create the main logger and tell it where to send the messages
$log = new Logger( 'billing' );
// add hashtag for stackify
$log->pushProcessor( function ( $record ) {
// https://github.com/Seldaek/monolog/blob/master/doc/message-structure.md
$record['message'] .= ' #billing';
return $record;
} );
$log->pushHandler( $handler_stackify );
The text was updated successfully, but these errors were encountered:
Using a custom processor to modify $record['message'] gets the job done, but it defies Monolog's convention somewhat, and would be less feasible in Monolog v3, where the property is read-only:
What would be ideal is if the handler could take in the channel and extra fields of Monolog\LogRecord, although I'm not sure if the model on Stackify's side has anywhere for this to go
Hi @pnoeric@paul-hendrick - This feature is now released for Monolog V3. You may need to add new arguments to include channel and extra in context for this to work.
Like the title says ;-) channels already exist in monolog to break log messages into various segments - billing, security, main, etc.
I wrote a custom processor to add '#' plus the channel name to my mesages that get sent to Stackify, so I can search the logs easily using y'alls nice hashtag feature. But it really should just be a part of this handler, no?
This is my very simple processor BTW
The text was updated successfully, but these errors were encountered: