Skip to content

Commit 5f504e9

Browse files
committed
renamed example
1 parent 1f9d5a5 commit 5f504e9

2 files changed

Lines changed: 37 additions & 37 deletions

File tree

examples/logging.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/php
2+
<?php
3+
require __DIR__ . '/../vendor/autoload.php';
4+
5+
use splitbrain\phpcli\CLI;
6+
use splitbrain\phpcli\Options;
7+
8+
class logging extends CLI // you may want to extend from PSR3CLI instead
9+
{
10+
// override the default log level
11+
protected $logdefault = 'debug';
12+
13+
// register options and arguments
14+
protected function setup(Options $options)
15+
{
16+
$options->setHelp('A very minimal example that demos the logging');
17+
}
18+
19+
// implement your code
20+
protected function main(Options $options)
21+
{
22+
$this->debug('This is a debug message');
23+
$this->info('This is a info message');
24+
$this->notice('This is a notice message');
25+
$this->success('This is a success message');
26+
$this->warning('This is a warning message');
27+
$this->error('This is a error message');
28+
$this->critical('This is a critical message');
29+
$this->alert('This is a alert message');
30+
$this->emergency('This is a emergency message');
31+
throw new \Exception('Exception will be caught, too');
32+
}
33+
}
34+
35+
// execute it
36+
$cli = new logging();
37+
$cli->run();

examples/minimal.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)