输出树视图

@param array     $config
@param integer   $level
514114
protected function treeView(array $config, int $level = 0)
    {
        foreach ($config as $name => $value) {
            if (is_array($value)) {
                $this->writeln(
                    sprintf(
                        '%s<info>- %s</>:',
                        str_repeat(' ', $level * 2),
                        $name
                    )
                );

                if (count($value) > 0) {
                    $this->treeView($value, ++$level);
                    --$level;
                }
            } else {
                if (is_int($name)) {
                    $this->writeln(
                        sprintf(
                            '%s<info>- %s</>',
                            str_repeat(' ', $level * 2),
                            $value
                        )
                    );
                } else {
                    $this->writeln(
                        sprintf(
                            '%s<info>- %s</>: %s',
                            str_repeat(' ', $level * 2),
                            $name,
                            $value
                        )
                    );
                }
            }
        }
    }
1010033
public function log($level, $message, array $context = array()) {
        $context['fromClass'] = get_called_class();
        foreach ($this->loggersInstances as $logger) {
            $logger->log($level, $message, $context);
        }
    }
416539
public function write($level, $message, array $context = array())
    {
        $color = $this->defaultColor;
        if (isset($this->levelColors[$level]) && $this->levelColors[$level]) {
            $color = $this->levelColors[$level];
        }

        $context = array(
            '__context' => $context,
            'color' => $color
        );

        $log = $this->format($level, $message, $context);
        $this->setLastLogLine($log);
        echo $log;
    }
947455
public static function log($level, $message, array $context = array())
    {
        App::getBean('Logger')->log($level, $message, static::parseContext($context));
    }
1077178
public function log($level, $message, array $context = array())
    {
        if ($this->loggerInstance !== null) {
            $this->loggerInstance->log($level, $message, $context);
        } elseif ($this->loggerCallback !== null) {
            call_user_func_array($this->loggerCallback, array($level, $message, $context));
        }
    }
557160
public function log($level, $message, array $context = [])
    {
        /** @var LoggerInterface|AdapterInterface $logTarget */
        foreach ($this->logTargets as $logTarget) {
            if (($logTarget instanceof AdapterInterface)) {
                $logTarget->log($this->getPhalconLoggerLevel($level), $message, $context);
            } else {
                $logTarget->log($level, $message, $context);
            }
        }
    }
166247
public function tLog(string $level, string $message, array $context = []) {
        $logtag = $this->getLogTag();
        if (is_array($message) || is_object($message)) {
            $message = print_r($message, true);
        }
        $this->log($level, "[{time}] [{$logtag}] ".$message, $context);
    }
353580
public function log($level, $message, array $context = array())
    {
        if (!array_key_exists($level, $this->levels)) {
            $level = $this->defaultLevel;
        }
        
        $level = \LoggerLevel::toLevel($this->levels[$level], $this->defaultLevel);
        
        $message = $this->formatter->format($level, $message, $context);

        $this->logger->log($level, $message);
    }
547520
protected function toFormatTree($data, $level = 0)
    {

        $title = $this->config['title'];

        if (is_object($data)) {
            $tmp_str                        = str_repeat("&nbsp;", $level * 4);
            $this->properties['level']      = $level;
            $this->properties['title_show'] = $data->properties[$title];
            if (!$data->children) {
                array_push($this->formatTree, $data->toArray());
            } else {
                array_push($this->formatTree, $data->toArray());
                $this->toFormatTree($data->children, $level + 1); //进行下一层递归
            }
        } else {
            $total  = count($data);
            $number = 1;
            foreach ($data as $key => $val) {
                $tmp_str = str_repeat("&nbsp;", $level * 4);
                if ($total == $number) {
                    $tmp_str .= $this->icon[2];
                } else {
                    $tmp_str .= $this->icon[1];
                }
                $val->properties['level']      = $level;
                $val->properties['title_show'] = $level == 0 ? $val->properties[$title] . "&nbsp;" : $tmp_str . "&nbsp;&nbsp;" . $val->properties[$title] . "&nbsp;";
                if (!$val->children) {
                    array_push($this->formatTree, $val->toArray());
                } else {
                    array_push($this->formatTree, $val->toArray());
                    $this->toFormatTree($val->children, $level + 1); //进行下一层递归
                }
                $number++;
            }
        }
        return;
    }
389432
protected function write($level, $msg)
    {
        $time = date('Y-m-d H:i:s', time());
        $msg = "[" . $time . "][" . static::getLevelName($level) . "] " . $msg . PHP_EOL;

        if($this->debugOutput === true){
            echo $msg;
        }
        if (static::$silent) {
            return false;
        }
        if (!$this->isAllowed($level)) {
            return false;
        }
        $fh = fopen($this->logFile, 'a');
        if (!fwrite($fh, $msg)) {
            throw new \Exception('Failed to write to log file at ' . $this->logFile);
        }

        return true;
    }
783710
public function sendMessage($level, $message)
    {
        if (is_resource($this->connect)) {
            fwrite($this->connect, '['.date('H:i:s d.m.Y').'] '.ucfirst($level).": {$message}\n");
        } else {
            throw new Exception('Error write log in file.');
        }
    }
904914
protected function logMessage($level, $message)
    {
        if (array_search($level, $this->levels) > $this->levelPosition) {
            return;
        }

        echo $message;
    }
1139616
public static function write($content, $level = self::DEBUG)
    {
        self::init();

        $driver = self::$driver;
        $driver::write($content, $level);
    }
979632
public function log($level, $message, array $context = [])
    {
        if (!$this->enabled) {
            return;
        }
        $message = self::replace($message, $context);
        if (is_resource($this->resource)) {
            fwrite($this->resource, "[{$level}] " . $message. "\n");
        } elseif (is_callable($this->resource)) {
            call_user_func($this->resource, "[{$level}] {$message}\n");
        } else {
            echo "[{$level}] {$message}\n";
        }
    }
1019228
protected function log($level, $msg, $context = [])
    {
        $this->log[$level][] = $msg;
        \Log::log($level, $msg, $context);
    }
936435
public function log($level, $message, array $data = [])
    {
        $this->getLogger()->log($level, $message, $data);
        $this->debugWriter->write($level, $message, $data);
    }
430650
public static function logToFile($message, $level)
    {
        if ($level > self::$config['level']) {
            return;
        }
        
        $filename = self::$config['filename'];
        $template = self::$config['message_template'];
        $tags = array(
            '%date%' => @date('Y-m-d H:i:s'), 
            '%level%' => $level,
            '%message%' => $message
        );
        
        $file = fopen($filename, 'a');
        fwrite($file, str_replace(array_keys($tags), array_values($tags), $template) . "\n");
        fclose($file);
        $file = null;
    }