解析日志
@access protected
@param  array     $info 日志信息
@return string
502944
protected function parseLog($info)
    {
        $requestInfo = [
            'ip'     => $this->app['request']->ip(),
            'method' => $this->app['request']->method(),
            'host'   => $this->app['request']->host(),
            'uri'    => $this->app['request']->url(),
        ];

        if ($this->config['json']) {
            $info = $requestInfo + $info;
            return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\r\n";
        }

        array_unshift($info, "---------------------------------------------------------------\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}");
        unset($info['timestamp']);

        return implode("\r\n", $info) . "\r\n";
    }
805281
public function log(array $log)
    {
        $log['db'] = $this->database->getName();
        $log['collection'] = $this->getName();
        call_user_func($this->loggerCallable, $log);
    }
54536
private function formatLogBatchHeader(array $records)
    {
        $firstRecord = $records[0];

        if ($this->isAsseticLog($firstRecord)) {
            return $this->formatAsSubtitle('Assetic request');
        }

        $logDate = $firstRecord['datetime'];
        $logDateAsString = $logDate->format('d/M/Y H:i:s');

        return $this->formatAsTitle($logDateAsString);
    }
412667
public function record($msg, $type = 'info', array $context = [])
    {
        if (is_string($msg)) {
            $replace = [];
            foreach ($context as $key => $val) {
                $replace['{' . $key . '}'] = $val;
            }

            $msg = strtr($msg, $replace);
        }

        $this->log[$type][] = $msg;

        if (PHP_SAPI == 'cli') {
            // 命令行日志实时写入
            $this->save();
        }

        return $this;
    }
191589
public function getUserEmail($info = NULL) {
    if (empty($info)) {
      $info = $this->getUserInfo();
    }
    $emails = $info->get('emails');
    if (is_array($emails) && count($emails)) {
      $email = reset($emails);
      return $email['value'];
    }
  }
1203190
private function log(string $operation, array $data, string $fields = '*', $where = '', bool $before = true, bool $after = true): bool
    {

        //检查是否需要记录数据库日志
        $operationLog = self::logEnabled();
        if (!$operationLog) {
            //不需要记录,直接执行
            return $this->execute2();
        }

        //如果需要保存之前数据
        if ($before) {
            //保存旧的statement对象
            $old = clone $this->statement;

            //查询修改前数据
            $data['before'] = $this->select2($fields, $where);

            //恢复statement对象
            $this->statement = clone $old;
        }

        //执行原始操作
        $result = $this->execute2();

        //如果需要记录操作后数据
        if ($after) {
            //查询修改后数据
            $data['after'] = $this->select2($fields, $where);
        }

        //记录日志
        call_user_func($operationLog, $this->tableName, $operation, $data);

        return $result;
    }
1077806
public static function info($info, $context)
    {
        self::$logger->pushHandler(new StreamHandler(self::$log_file), Logger::INFO);
        return self::$logger->info($info, $context);
    }
1010299
public function save(array $log = [])
    {
        if ($this->config['single']) {
            $name        = is_string($single) ? $single : 'single';
            $destination = $this->config['path'] . $name . '.log';
        } else {
            $cli         = PHP_SAPI == 'cli' ? '_cli' : '';
            $destination = $this->config['path'] . date('Ym') . '/' . date('d') . $cli . '.log';
        }

        $path = dirname($destination);
        !is_dir($path) && mkdir($path, 0755, true);

        $info = '';
        foreach ($log as $type => $val) {
            $level = '';
            foreach ($val as $msg) {
                if (!is_string($msg)) {
                    $msg = var_export($msg, true);
                }
                $level .= '[ ' . $type . ' ] ' . $msg . "\r\n";
            }

            if (in_array($type, $this->config['apart_level'])) {
                // 独立记录的日志级别
                if ($this->config['single']) {
                    $filename = $path . '/' . $name . '_' . $type . '.log';
                } else {
                    $filename = $path . '/' . date('d') . '_' . $type . $cli . '.log';
                }

                $this->write($level, $filename, true);
            } else {
                $info .= $level;
            }
        }

        if ($info) {
            return $this->write($info, $destination);
        }

        return true;
    }
646194
protected static function encodeVarList(array &$info)
    {
        foreach ($info as $k => &$var) {
            // alias parse
            $var['annotation']['name'] = self::aliasMapParse($var['annotation']['name']);
            self::setInput($var);
            $info[$k]['buildStr'] = forward_static_call_array([
                $var['annotation']['name'],
                'exec'
            ], [
                'argv' => $var, // 环境相关参数，描述当前注解使用作用域名的上下文信息
                'param' => $var['annotation']['param']
            ]);
            self::$output = $info[$k]['buildStr'];
        }
    }
854459
protected static function encodeMethodList(array &$info)
    {
        foreach ($info as $k => &$method) {
            // alias parse
            $method['annotation']['name'] = self::aliasMapParse($method['annotation']['name']);
            self::setInput($method);
            $info[$k]['buildStr'] = forward_static_call_array([
                $method['annotation']['name'],
                'exec'
            ], [
                'argv' => $method, // 环境相关参数，描述当前注解使用作用域名的上下文信息
                'param' => $method['annotation']['param'],
                'body' => AnnotationBodyParser::parseMethod($method['method'], self::$arrInput)
            ]);
            self::$output = $info[$k]['buildStr'];
        }
    }
96854
public function info(
        $msg,
        array $args = array(),
        \Exception $exception = null
    ) {
        return $this->log(\Plop\INFO, $msg, $args, $exception);
    }
1255296
protected function createDump(Infoset $info) {
		$content = '';
		
		foreach ($info as $part) {
			$content .= Dump::getDump($part);
		}
		
		return $content;
	}
1293669
public static function enterprisePayLog($log){
		$filename=storage_path('wechat_enterprise_pay/'.date('Ymd').'.txt');
		$path=dirname($filename);

		load_helper('File');

		if (dir_exists($path)) {//创建图片目录
			$log=self::$guid.'------'.date('Y-m-d H:i:s').':'.$log;
			file_put_contents($filename,$log.PHP_EOL.PHP_EOL,FILE_APPEND);
		}

		return true;
	}
229229
protected static function getLogger()
    {
        static $day;

        if (static::$logger && $day == date('Y-m-d')) {
            return static::$logger;
        }

        $day = date('Y-m-d');

        $config = static::getConfig();
        $logger = new Logger($config['channel']);

        // 单元测试时不执行
        if (defined('PHPUNIT_RUNNING')) {
            $logger->pushHandler(new NullHandler());
        } else {
            // Syslog Log Handler
            if (isset($config['syslog']) && isset($config['syslog']['host'], $config['syslog']['port'])) {
                $handler = new SyslogUdpHandler($config['syslog']['host'], $config['syslog']['port'], LOG_USER, $config['level']);
                $handler->setFormatter(new LineFormatter(static::getFormat()));
                $logger->pushHandler($handler);
            }

            // File Log Handler
            if (isset($config['file'])) {
                if (!isset($config['file']['dir'])) {
                    throw new ConfigException('No log config!');
                }
                $logDir = $config['file']['dir'];
                $logFile = $logDir . '/' . $day . '.log';

                $handler = new StreamHandler($logFile, $config['level'], true, 0777);
                $handler->setFormatter(new LineFormatter(static::getFormat() . "\n"));
                $logger->pushHandler($handler);
            }
        }

        return static::$logger = $logger;
    }
519872
public function find(array $info)
    {
        $result = array();

        if($info['path'] && $info['locale'])
        {
            $pattern = $info['path'].'/'.$info['locale'].'.*';
            $results = glob($pattern);

            if ($results)
            {
                foreach($results as $file)
                {
                    if($path = $this->realPath($file))
                    {
                        $result[] = $path;
                        break;
                    }
                }
            }
        }

        return $result;
    }
62449
public function logNotice($message)
    {
        if (func_num_args() > 1) {
            $message = $this->_prepareLogMessage(func_get_args());
        }

        return $this->_log(Zend_Log::NOTICE, $message);
    }
765985
public function connect(Info $info): PDO {
    try {
      $mysql = new PDO("{$info->getDsn()}:host={$info->getHost()};dbname={$info->getDbname()};port={$info->getPort()};charset={$info->getCharset()}", $info->getUser(), $info->getPassword(), array(
        PDO::ATTR_AUTOCOMMIT => false,
        PDO::ATTR_PERSISTENT => false,
        PDO::ATTR_EMULATE_PREPARES => true,
        PDO::ATTR_TIMEOUT => 1800,
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES {$info->getCharset()}"
      ));
    } catch (Exception $ex) {
      $mysql = null;
      throw $ex;
    }
    return $mysql;
  }