summaryrefslogtreecommitdiffstats
path: root/library/Director/Daemon/Logger.php
blob: 27fcbf5f8b0dd0342a75b998548215565d38acd0 (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
<?php

namespace Icinga\Module\Director\Daemon;

use Icinga\Application\Logger as IcingaLogger;
use Icinga\Application\Logger\LogWriter;
use Icinga\Exception\ConfigurationError;

class Logger extends IcingaLogger
{
    public static function replaceRunningInstance(LogWriter $writer, $level = null)
    {
        try {
            $instance = static::$instance;
            if ($level !== null) {
                $instance->setLevel($level);
            }

            $instance->writer = $writer;
        } catch (ConfigurationError $e) {
            self::$instance->error($e->getMessage());
        }
    }
}