PHP code example of bfocus / monitor
1. Go to this page and download the library: Download bfocus/monitor 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/ */
bfocus / monitor example snippets
\Bfocus\Monitor\Monitor::init([
'key' => 'bf_mon_…',
'release' => '1.4.2',
'environment' => 'production',
'signing_secret' => getenv('BFOCUS_SIGNING_SECRET'),
]);
->withExceptions(function (Exceptions $exceptions) {
\Bfocus\Monitor\Laravel::register($exceptions);
})
public function register(): void
{
\Bfocus\Monitor\Laravel::register($this);
}
// No Mezzio: DEPOIS do ErrorHandler (dentro dele) e antes das rotas.
$app->pipe(new \Bfocus\Monitor\Psr15Middleware());
\Bfocus\Monitor\Monitor::setUser($user->id, $user->company_id);
use Bfocus\Monitor\Monitor;
try {
emitirNota();
} catch (\Throwable $e) {
Monitor::captureException($e, ['tags' => ['modulo' => 'fiscal']]);
}
Monitor::captureMessage('estoque negativo', 'warning');
Monitor::setTag('filial', 'POA');
Monitor::addBreadcrumb('fiscal', 'XML assinado');
Monitor::flush(2.0); // worker, fila, job longo