summaryrefslogtreecommitdiffstats
path: root/library/Director/Daemon/SystemdLogWriter.php
blob: 8b64442e9dd0cd2f10b95c584132122fbd1db848 (plain)
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
<?php

namespace Icinga\Module\Director\Daemon;

use Icinga\Application\Logger\LogWriter;
use Icinga\Data\ConfigObject;

class SystemdLogWriter extends LogWriter
{
    protected static $severityMap = [
        Logger::DEBUG   => 7,
        Logger::INFO    => 6,
        Logger::WARNING => 4,
        Logger::ERROR   => 3,
    ];

    public function __construct()
    {
        parent::__construct(new ConfigObject([]));
    }

    public function log($severity, $message)
    {
        $severity = self::$severityMap[$severity];
        echo "<$severity>$message\n";
    }
}