Email Adapter
Use the email adapter to send log information to an email address.
<?php
use Vespula\Log\Adapter\Email as EmailAdapter;
use Vespula\log\Adapter\Log;
$to = 'me@example.com';
$from = 'do-not-reply@example.com';
$subject = 'MyApp Log';
$adapter = new EmailAdapter($to, $from, $subject);
$log = new Log($adapter);
$log->info('This is informative');
$context = [
'id'=>45
];
$log->error('Failed to update record {id}', $context);
Additional Headers
You can pass additional headers to the adapter at construction. The headers will automatically have “rn” appended to them.
<?php
use Vespula\Log\Adapter\Email as EmailAdapter;
use Vespula\log\Adapter\Log;
$to = 'me@example.com';
$from = 'do-not-reply@example.com';
$subject = 'MyApp Log';
$headers = [
'X-Priority: 1'
];
$adapter = new EmailAdapter($to, $from, $subject, $headers);
$log = new Log($adapter);
$log->info('This is informative');