-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
33 lines (26 loc) · 769 Bytes
/
Copy pathbootstrap.php
File metadata and controls
33 lines (26 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
declare(strict_types=1);
use Monolog\Handler\StreamHandler;
use Monolog\Level;
use Monolog\Logger;
use Symfony\Component\Dotenv\Dotenv;
function loadDotenv(): void
{
if (file_exists($env = __DIR__ . '/.env')) {
$dotenv = new Dotenv();
$dotenv->load($env);
}
}
loadDotenv();
function info(string $message = 'info', array $context = []): void
{
$log = new Logger('info');
$log->pushHandler(new StreamHandler(LOGDIR . '/info.log', Level::Notice));
$log->notice('info', ['name' => 'Felipe']);
}
function error(string $message = 'error', array $context = []): void
{
$log = new Logger('error');
$log->pushHandler(new StreamHandler(LOGDIR . '/error.log', Level::Error));
$log->notice('error', ['this crashed']);
}