public function writeLogSections($section, $data, $file = '', $line = '', $matchKey = null)
    {
        if (!is_array($this->Profiler->log_sections)) {
            $this->Profiler->log_sections = [];
        }

        if (!array_key_exists($section, $this->Profiler->log_sections)) {
            // if section is not exists in the key means it was not registered, get out of this function.
            return ;
        }

        if (!is_string($matchKey)) {
            $matchKey = null;
        }

        if ($section == 'Logs') {
            if (is_array($data) && array_key_exists('logtype', $data) && array_key_exists('data', $data)) {
                $logtype = $data['logtype'];
                $data = $data['data'];
            }
        }

        $section_data_array = [
            'data' => $data,
            'file' => $file,
            'line' => $line,
        ];
        if ($matchKey !== null) {
            $section_data_array['matchKey'] = $matchKey;
        }
        if ($section == 'Time Load') {
            $section_data_array['time'] = $this->Profiler->getMicrotime();
        }
        if ($section == 'Memory Usage') {
            $section_data_array['memory'] = memory_get_usage();
        }

        if (isset($logtype)) {
            $section_data_array['logtype'] = $logtype;
        }

        $this->Profiler->log_sections[$section][] = $section_data_array;
        unset($section_data_array);
    }
public function writeLogSections($section, $data, $file = '', $line = '', $matchKey = null)
    {
        if (!is_array($this->Profiler->log_sections)) {
            $this->Profiler->log_sections = [];
        }

        if (!array_key_exists($section, $this->Profiler->log_sections)) {
            // if section is not exists in the key means it was not registered, get out of this function.
            return ;
        }

        if (!is_string($matchKey)) {
            $matchKey = null;
        }

        if ($section == 'Logs') {
            if (is_array($data) && array_key_exists('logtype', $data) && array_key_exists('data', $data)) {
                $logtype = $data['logtype'];
                $data = $data['data'];
            }
        }

        $section_data_array = [
            'data' => $data,
            'file' => $file,
            'line' => $line,
        ];
        if ($matchKey !== null) {
            $section_data_array['matchKey'] = $matchKey;
        }
        if ($section == 'Time Load') {
            $section_data_array['time'] = $this->Profiler->getMicrotime();
        }
        if ($section == 'Memory Usage') {
            $section_data_array['memory'] = memory_get_usage();
        }

        if (isset($logtype)) {
            $section_data_array['logtype'] = $logtype;
        }

        $this->Profiler->log_sections[$section][] = $section_data_array;
        unset($section_data_array);
    }
public function writeLogSections ( $ section , $ data , $ file = '' , $ line = '' , $ matchKey = null ) { if ( ! is_array ( $ this -> Profiler -> log_sections ) ) { $ this -> Profiler -> log_sections = [ ] ; } if ( ! array_key_exists ( $ section , $ this -> Profiler -> log_sections ) ) { // if section is not exists in the key means it was not registered, get out of this function. return ; } if ( ! is_string ( $ matchKey ) ) { $ matchKey = null ; } if ( $ section == 'Logs' ) { if ( is_array ( $ data ) && array_key_exists ( 'logtype' , $ data ) && array_key_exists ( 'data' , $ data ) ) { $ logtype = $ data [ 'logtype' ] ; $ data = $ data [ 'data' ] ; } } $ section_data_array = [ 'data' => $ data , 'file' => $ file , 'line' => $ line , ] ; if ( $ matchKey !== null ) { $ section_data_array [ 'matchKey' ] = $ matchKey ; } if ( $ section == 'Time Load' ) { $ section_data_array [ 'time' ] = $ this -> Profiler -> getMicrotime ( ) ; } if ( $ section == 'Memory Usage' ) { $ section_data_array [ 'memory' ] = memory_get_usage ( ) ; } if ( isset ( $ logtype ) ) { $ section_data_array [ 'logtype' ] = $ logtype ; } $ this -> Profiler -> log_sections [ $ section ] [ ] = $ section_data_array ; unset ( $ section_data_array ) ; }
Write other sections logs.

@param string $section The section name.
@param mixed $data Log data. This can be any type.
@param string $file Path to file where it calls logger. (optional).
@param integer $line Number of line in that file that calls logger. (optional).
@param string|null $matchKey The key to be match at the beginning and end for calculate total time or memory only for this key. (optional). The key must be unique (for start and end) in each section.
Write other sections logs .