File Adapter

The file adapter uses PHP's error_log() function to write the log to a file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<?php
use Vespula\Log\Adapter\File as FileAdapter;
use Vespula\log\Adapter\Log;

$file = '/tmp/mylog.txt';

$adapter = new FileAdapter($file);

$log = new Log($adapter);

$log->info('This is informative');

$context = [
    'id'=>45
];
$log->error('Failed to update record {id}', $context);