Completed
Pull Request — master (#29)
by
unknown
12:05
created

TestConnectionTask::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Mbovis\Tasks;
4
5
use Monolog\Logger;
6
use Psr\Log\LoggerInterface;
7
use SilverStripe\Core\Injector\Injector;
8
use SilverStripe\Dev\BuildTask;
9
10
class TestConnectionTask extends BuildTask
11
{
12
    protected $title = 'Test Sentry Configuration';
13
14
    protected $description = 'Captures message for all levels available';
15
16
    /**
17
     * Implement this method in the task subclass to
18
     * execute via the TaskRunner
19
     *
20
     * @param \SilverStripe\Control\HTTPRequest|null $request
21
     */
22
    public function run($request = null)
23
    {
24
        /** @var LoggerInterface $logger */
25
        $logger = Injector::inst()->get(LoggerInterface::class);
26
27
        foreach (Logger::getLevels() as $name => $value) {
28
            $func = strtolower($name);
29
            $logger->$func('Testing Severity Level: ' . $name);
30
            printf("Security Level: %s <br/>\n", $name);
31
        }
32
33
    }
34
}
35