PHP code example of theseer / journald
1. Go to this page and download the library: Download theseer/journald library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
theseer / journald example snippets
use theseer\journald\JournalWriter;
use theseer\journald\JournalEntry;
use theseer\journald\SocketPath;
function sample() {
throw new RuntimeException('Test Exception Message');
}
try {
sample();
} catch (Throwable $t) {
(new JournalWriter(SocketPath::default()))->write(
JournalEntry::fromThrowable($t)
);
}
(new JournalWriter(SocketPath::default()))->write(
JournalEntry::fromMessage('This is a test')
);