-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathlogging.php
More file actions
executable file
·37 lines (32 loc) · 1.09 KB
/
logging.php
File metadata and controls
executable file
·37 lines (32 loc) · 1.09 KB
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
34
35
36
37
#!/usr/bin/php
<?php
require __DIR__ . '/../vendor/autoload.php';
use splitbrain\phpcli\CLI;
use splitbrain\phpcli\Options;
class logging extends CLI // you may want to extend from PSR3CLI instead
{
// override the default log level
protected $logdefault = 'debug';
// register options and arguments
protected function setup(Options $options)
{
$options->setHelp('A very minimal example that demos the logging');
}
// implement your code
protected function main(Options $options)
{
$this->debug('This is a debug message');
$this->info('This is a info message');
$this->notice('This is a notice message');
$this->success('This is a success message');
$this->warning('This is a warning message');
$this->error('This is a error message');
$this->critical('This is a critical message');
$this->alert('This is a alert message');
$this->emergency('This is a emergency message');
throw new \Exception('Exception will be caught, too');
}
}
// execute it
$cli = new logging();
$cli->run();