Displays the callstack of the profiling procedures for display.
@param array $logs list of logs
@throws CException if Yii::beginProfile() and Yii::endProfile() are not matching
421492
protected function displayCallstack($logs)
	{
		$stack=array();
		$results=array();
		$n=0;
		foreach($logs as $log)
		{
			if($log[1]!==CLogger::LEVEL_PROFILE)
				continue;
			$message=$log[0];
			if(!strncasecmp($message,'begin:',6))
			{
				$log[0]=substr($message,6);
				$log[4]=$n;
				$stack[]=$log;
				$n++;
			}
			elseif(!strncasecmp($message,'end:',4))
			{
				$token=substr($message,4);
				if(($last=array_pop($stack))!==null && $last[0]===$token)
				{
					$delta=$log[3]-$last[3];
					$results[$last[4]]=array($token,$delta,count($stack));
				}
				else
					throw new CException(Yii::t('yii','CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.',
						array('{token}'=>$token)));
			}
		}
		// remaining entries should be closed here
		$now=microtime(true);
		while(($last=array_pop($stack))!==null)
			$results[$last[4]]=array($last[0],$now-$last[3],count($stack));
		ksort($results);
		$this->render('profile-callstack',$results);
	}
9933
public function log(array $log)
    {
        if ($this->loggerCallable) {
            call_user_func($this->loggerCallable, array_merge($this->logDefault, $log));
        }
    }
1275666
public function registerProfilerLoggerEvent()
	{
		$app = $this->app;

		$app['events']->listen('illuminate.log', function($level, $message, $context) use ($app)
		{
			if($app['profiler']->isEnabled())
			{
				$app['profiler']->log->log($level, $message, $context);
			}
		});
	}
613550
protected function executeProcesses($processes, DeploynautLogFile $log) {
		foreach($processes as $process) {
			$process->mustRun(function ($type, $buffer) use($log) {
				$log->write($buffer);
			});
		}
	}
969381
protected function loadProfileByKey($key)
    {
        if (isset($this->profiles['profiles'][$key])) {
            $profile = $this->profiles['profiles'][$key];

            if (is_array($profile)) {
                $this->mergeProfileWithConfig($profile);
            }
        }
    }
274168
public function index() {
		$logs = [];
		$typesWithCount = $this->DatabaseLogs->getTypesWithCount();

		$lastErrors = $this->DatabaseLogs->find()
			->select(['summary'])
			->where(['type' => 'error'])
			->group('summary')
			->orderDesc('id')
			->limit(10)
			->disableHydration()
			->all()->toArray();

		$this->set(compact('logs', 'typesWithCount', 'lastErrors'));
	}
470671
private function isEndOfLog($log)
    {
        $is_end = preg_match('/\nTime: \d+ s./', $log);

        // end of execute scan on Windows
        $root = realpath($this->getParameter('kernel.root_dir').'/../');
        $is_end_win = preg_match('/\n'.preg_quote($root).'>/', $log);

        // detect fatal error in log
        $is_end_error = strpos($log, 'Fatal error: ') != false;

        return $is_end || $is_end_win || $is_end_error;
    }
844734
public static function logProfiling(array $log_data)
    {
        if (self::$profiling_count > self::$profiling_max) {
            return;
        }

        self::$profiling_count++;
        if (isset($log_data['errorno'])) {
            self::$profiling[] = array(
                'url'       => $log_data['url'],
                'errorno'   => $log_data['errorno'],
                'error'     => $log_data['error'],
                'queue'     => $log_data['queue'],
            );
        } else {
            self::$profiling[] = array(
                'url'               => $log_data['url'],
                'http_code'         => $log_data['http_code'],
                'total_time'        => $log_data['total_time'],
                'pretransfer_time'  => $log_data['pretransfer_time'],
                'queue'             => $log_data['queue'],
            );
        }
    }
1232898
protected function _log($messages)
    {
        if (!is_array($messages)) {
            $messages = [$messages];
        }
        foreach ($messages as $message) {
            file_put_contents(static::$logFile, date('d.m.Y H:i:s') . ' - ' . $message . PHP_EOL, FILE_APPEND | LOCK_EX);
        }
    }
646650
private function prepareLogLevels(string $level)
    {
        $levels = [
            LogLevel::EMERGENCY,
            LogLevel::ALERT,
            LogLevel::CRITICAL,
            LogLevel::ERROR,
            LogLevel::WARNING,
            LogLevel::NOTICE,
            LogLevel::INFO,
            LogLevel::DEBUG,
        ];

        $key = array_search($level, $levels);

        if (null !== $key) {
            $this->levels = array_slice($levels, 0, $key + 1);
        }
    }
742365
public function log(array $log)
    {
        if (null !== $this->config->getLoggerCallable()) {
            call_user_func($this->config->getLoggerCallable(), $log);
        }
    }
805281
public function log(array $log)
    {
        $log['db'] = $this->database->getName();
        $log['collection'] = $this->getName();
        call_user_func($this->loggerCallable, $log);
    }
1341483
public function indexAction()
  {
    try
    {
      /* query server logs */
      $this->tpl->ts3_logs = $this->ts3->logView(100);
    }
    catch(Exception $e)
    {
      /* save catched error mesage */
      $this->setLastEvent($e->getMessage(), TRUE);

      /* fallback to default values */
      $this->tpl->ts3_logs = array();
    }

    $this->assignLastEvent();
  }
1345910
public function profileEnd($title = null, array $context = [])
    {
        if (!$this->activeKey) {
            return;
        }

        list($category, $name) = explode('|', $this->activeKey);

        if (isset($this->profiles[$category][$name])) {
            $data = $this->profiles[$category][$name];

            $old = $data['_profile_stats'];
            $data['_profile_stats'] = PhpHelper::runtime($old['startTime'], $old['startMem']);
            $data['_profile_end'] = $context;

            $title = $category . ' - ' . ($title ?: $name);

            $this->activeKey = null;
            $this->log(Logger::DEBUG, $title, $data);
        }
    }
341618
protected function formatLog(array $log): array
    {
        foreach ($log as &$logItem) {
            if ($logItem['type'] === 'model' || $logItem['type'] === 'field') {
                $logItem['action'] = $logItem['item']['action'];
            }

            if ($logItem['type'] === 'field') {
                $logItem['field'] = $logItem['item']['field'];
            }

            $formattedItem = $this->formatItem($logItem['type'], $logItem['item']);
            unset($logItem['item']);
            $logItem += $formattedItem;

            if (!empty($logItem['message'])) {
                continue;
            }

            if (is_array($logItem['permissions']) && array_key_exists('no_bypass', $logItem['permissions'])) {
                $logItem['permissions']['NO_BYPASS'] = $logItem['permissions']['no_bypass'];
                unset($logItem['permissions']['no_bypass']);
            }

            $typeKeys = array_keys($this->lpProxy->getTypes());

            $logItem['permission_no_bypass_checks'] = array_reverse($this->getPermissionNoBypassChecks($logItem['permissions'], $logItem['context'], $typeKeys));
            if (count($logItem['permission_no_bypass_checks']) == 1 && !empty($logItem['permission_no_bypass_checks'][0]['error'])) {
                $logItem['message'] = $logItem['permission_no_bypass_checks'][0]['error'];
            }

            $logItem['bypassed_access'] = $this->getBypassedAccess($logItem['permissions'], $logItem['context']);

            $purePermissions = $logItem['permissions'];
            unset($purePermissions['NO_BYPASS']);

            $logItem['permission_checks'] = array_reverse($this->getPermissionChecks($purePermissions, $logItem['context'], $typeKeys));
            if (count($logItem['permission_checks']) == 1 && !empty($logItem['permission_checks'][0]['error'])) {
                $logItem['message'] = $logItem['permission_checks'][0]['error'];
            }

            unset($logItem['context']);
        }
        unset($logItem);

        return $log;
    }
663278
final protected function _log($type, array $args)
	{
		// nothing passed in, don't do anything
		if (count($args) === 0 && $type !== self::GROUP_END) {
			return;
		}
		$this->_processed = array();

		$logs = array_map([$this, '_convert'], $args);
		$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
		$backtrace_message = 'unknown';
		$backtrace = end($backtrace);
		if (isset($backtrace['file'], $backtrace['line'])) {
			$backtrace_message = $this->_formatLocation(
				$backtrace['file'],
				$backtrace['line']
			);
		}
		$this->_addRow($logs, $backtrace_message, $type);
	}
772498
private function mapLogsRoutes()
    {
        $this->prefix('logs')->name('logs.')->group(function() {
            $this->get('/', 'LogViewerController@listLogs')
                 ->name('list'); // log-viewer::logs.list

            $this->delete('delete', 'LogViewerController@delete')
                 ->name('delete'); // log-viewer::logs.delete

            $this->prefix('{date}')->group(function() {
                $this->get('/', 'LogViewerController@show')
                     ->name('show'); // log-viewer::logs.show

                $this->get('download', 'LogViewerController@download')
                     ->name('download'); // log-viewer::logs.download

                $this->get('{level}', 'LogViewerController@showByLevel')
                     ->name('filter'); // log-viewer::logs.filter

                $this->get('{level}/search', 'LogViewerController@search')
                     ->name('search'); // log-viewer::logs.search
            });
        });
    }