Set the default log handler.

@param string $logHandler

@throws \Exception
773381
public function setDefaultHandler($name)
    {
        if (!array_key_exists($name, $this->logRegistry)) {
            throw new \Exception('LogHandler named ['.$name.'] does not exist');
        }
        $this->defaultLogHandler = $name;
    }
575341
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;
        $this->getLogger()->info('ClientHandler is started with pid '.getmypid());
    }
448188
public function handleException($exception)
    {
        $this->setExceptionHandler(null);
        $this->setErrorHandler(null);
        
        $isInstanceOf = array_map(function ($class) use ($exception) {
            return is_a($exception, $class);
        }, $this->logExceptionClasses);
        
        if ($exception instanceof \Error || $exception instanceof \ErrorException) {
            $type = $exception instanceof \Error ? $exception->getCode() : $exception->getSeverity();
            $shouldLog = $this->getLoggedErrorTypes() & $type;
        } else {
            $shouldLog = array_sum($isInstanceOf) > 0;
        }
        
        if ($shouldLog) {
            $this->log($exception);
        }
        
        $this->callOnFatalError($exception);
        
        if ($this->chainedExceptionHandler) {
            call_user_func($this->chainedExceptionHandler, $exception);
        }
        
        throw $exception; // This is now handled by the default exception and error handler
    }
893405
public static function register(LoggerInterface $logger = null)
    {
        $handler = new static($logger);

        set_error_handler(array($handler, 'handleError'));
        register_shutdown_function(array($handler, 'handleFatalError'));

        set_exception_handler(array($handler, 'handleException'));
    }
45551
public function logger() : void
  {
    LogHandler::$disk = DEPConfig::$appdir . 'storage' . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR;
    LogHandler::$name = config('app.logger.name');
    LogHandler::$log  = config('app.logger.log');
    LogHandler::$env  = config('app.env');

    LogHandler::event(function($env, $level, $message, $array) {
      Events::trigger('output.log', [$env, $level, $message, $array]);
    });
  }
1096332
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;
        $this->getClient()->setLogger($logger);
    }
851212
public function setLogger($value)
    {
        if ($value === null || $value instanceof LoggerInterface) {
            $this->logger = $value;
        } else {
            $this->logger = new LoggerWrapper($value);
        }
        if ($this->apiClient !== null) {
            $this->apiClient->setLogger($this->logger);
        }
    }
859012
public function setXincLogFile($logFile)
    {
        $parentDir = dirname($logFile);

        if (!is_writeable($logFile) && !is_writeable($parentDir)) {
            $this->error('Cannot open "'.$logFile.'" for writing', STDERR);
            throw new Logger\Exception\NonWriteableException($logFile);
        }
        $this->file = $logFile;
    }
267224
public function setLogger(LoggerInterface $logger):void{
		$this->logger = $logger;
		$this->driver->setLogger($logger);
		$this->query->setLogger($logger);
	}
345107
public static function setHandler($level = null, $handler = null)
    {
        if (empty($level)) {
            $level = static::DEFAULT_LEVEL;
        }

        if (!empty($handler)) {
            static::$handler = $handler;
            return;
        }

        static::$handler = new \Monolog\Handler\StdoutHandler(constant("\Monolog\Logger::$level"));
        static::$handler->setFormatter(static::getFormatter());
    }
812480
public function addLogHandler(array $logHandlers, $createLogger = false) {
        try {
            $this->configuredLogHandlers = array_merge($this->configuredLogHandlers, $logHandlers);

            if ($createLogger === true) {
                $this->createLogger($this->channelName);
                $this->createLogHandlers();
            }            
        } catch (Exception $ex) {
            throw new LoggerException (
                "An exception occurred when adding the Log Handler to "
                . $this->channelName
                . ":"
                . $ex->getMessage()
            );
        }
    }
1058235
public static function registerExceptionHandler(Logger $logger)
    {
        // Only register once per instance
        if (self::$registeredExceptionHandler) {
            return false;
        }

        if ($logger === null) {
            throw new \Zend\Log\Exception\InvalidArgumentException('Invalid Logger specified');
        }

        set_exception_handler(
                    /* var $exception Exception */
            function (\Exception $exception) use ($logger) {
                    $msg = '';
                    $prev = $exception->getPrevious();
                    while ($prev !== null) {
                        $msg .= PHP_EOL.'Previous: '.$prev->getMessage().
                                 ' in '.$prev->getFile().' in line '.
                                 $prev->getLine().'.';
                        $prev = $prev->getPrevious();
                    }
                    $logger->log(ErrorLogger::ERR,
                            'Exception: '.$exception->getMessage().' in '.
                                     $exception->getFile().' in line '.
                                     $exception->getLine().'.'.$msg.PHP_EOL.
                                     'Trace:'.PHP_EOL.
                                     $exception->getTraceAsString());
                });
        self::$registeredExceptionHandler = true;

        return false;
    }
782867
public function setLogger( LoggerInterface $logger ) {
		$this->logger = $logger;
		$this->session->setLogger( $logger );
	}
84389
public function setLogger($logger = null)
    {
        if (! (is_null($logger)
            || $logger instanceof LoggerInterface)) {
            throw new InvalidArgumentException(
                'Argument to ' . __METHOD__ .
                " must be a valid Logger Interface (aka. Monolog), " .
                get_class($logger) . ' given.'
            );
        }

        $this->logger = $logger;
    }
63985
def _add_handler(logger, handler=None, loglevel=None):
    
    handler.setLevel(loglevel or DEFAULT_LOGLEVEL)
    if handler.level <= logging.DEBUG:
        _fmt = '%(asctime)s| %(levelname)-4.3s|%(threadName)10.9s/' \
               '%(lineno)04d@%(module)-10.9s| %(message)s'
        handler.setFormatter(logging.Formatter(_fmt))
    else:
        handler.setFormatter(logging.Formatter(
            '%(asctime)s| %(levelname)-8s| %(message)s'
        ))
    logger.addHandler(handler)
334636
protected function logException(\Exception $exception): void
    {
        if (!$this->logger) {
            return;
        }

        $message = sprintf(
            'Exception thrown when handling an exception (%s: %s at %s line %s)',
            get_class($exception),
            $exception->getMessage(),
            $exception->getFile(),
            $exception->getLine()
        );

        $this->logger->log($this->level, $message, [
            'exception' => $exception,
        ]);
    }
1333951
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;
        if (isset($logger)) {
            $this->parser->setLogger($logger);
            $this->nsParser->setLogger($logger);
        }
    }