src/includes/classes/Core/Utils/Debugging.php
protected function maybeLog($data = [], string $note = '', string $event = ''): int
    {
        if (!$this->App->Config->©debug['©log']) {
            return 0; // Not applicable.
        }
        $is_cli       = $this->c::isCli();
        $is_wordpress = $this->c::isWordPress();
        $event        = $this->cleanLogEvent($event);

        $lines[] = __('Time:').'         '.date('F jS, Y, g:i a T');
        $lines[] = __('Microtime:').'    '.number_format(microtime(true), 8, '.', '');
        $lines[] = __('Event:').'        '.($event ? $event : __('unknown event name'));
        $lines[] = __('Note:').'         '.($note ? $note : __('no note given by caller'))."\n";

        $lines[] = __('System:').'       '.PHP_OS.'; PHP v'.PHP_VERSION.' ('.PHP_SAPI.')';
        $lines[] = __('Software:').'     WSC v'.Classes\App::VERSION.// Core app class version.

                                         ($is_wordpress ? '; WP v'.$GLOBALS['wp_version'] : '').
                                         ($is_wordpress && defined('WC_VERSION') ? '; WC v'.WC_VERSION : '').

                                         ($this->App->Parent ? '; '.$this->App->Parent->Config->©brand['©acronym'].' v'.$this->App->Parent::VERSION : '').
                                        (!$this->App->is_ws_core ? '; '.$this->App->Config->©brand['©acronym'].' v'.$this->App::VERSION : '')."\n";

        if ($is_wordpress && ($user = wp_get_current_user()) && $user->exists()) {
            $lines[] = __('User:').'         #'.$user->ID.' @'.$user->user_login.' \''.$user->display_name.'\'';
        }
        $lines[] = __('User IP:').'      '.($is_cli ? __('n/a; CLI process') : $this->c::currentIp());
        $lines[] = __('User Agent:').'   '.($is_cli ? __('n/a; CLI process') : ($_SERVER['HTTP_USER_AGENT'] ?? ''));
        $lines[] = __('URL:').'          '.($is_cli ? __('n/a; CLI process') : $this->c::currentUrl())."\n";

        $lines[] = $this->c::mbTrim($this->c::dump($data, true), "\r\n"); // A dump of the data (variables).

        if (is_callable($this->App->Config->©debug['©log_callback'])) {
            $this->App->Config->©debug['©log_callback'](compact('event', 'data', 'note', 'lines'));
        }
        return $this->writeLogFileLines($event, $lines); // Writes the log entry.
    }
protected function maybeLog($data = [], string $note = '', string $event = ''): int
    {
        if (!$this->App->Config->©debug['©log']) {
            return 0; // Not applicable.
        }
        $is_cli       = $this->c::isCli();
        $is_wordpress = $this->c::isWordPress();
        $event        = $this->cleanLogEvent($event);

        $lines[] = __('Time:').'         '.date('F jS, Y, g:i a T');
        $lines[] = __('Microtime:').'    '.number_format(microtime(true), 8, '.', '');
        $lines[] = __('Event:').'        '.($event ? $event : __('unknown event name'));
        $lines[] = __('Note:').'         '.($note ? $note : __('no note given by caller'))."\n";

        $lines[] = __('System:').'       '.PHP_OS.'; PHP v'.PHP_VERSION.' ('.PHP_SAPI.')';
        $lines[] = __('Software:').'     WSC v'.Classes\App::VERSION.// Core app class version.

                                         ($is_wordpress ? '; WP v'.$GLOBALS['wp_version'] : '').
                                         ($is_wordpress && defined('WC_VERSION') ? '; WC v'.WC_VERSION : '').

                                         ($this->App->Parent ? '; '.$this->App->Parent->Config->©brand['©acronym'].' v'.$this->App->Parent::VERSION : '').
                                        (!$this->App->is_ws_core ? '; '.$this->App->Config->©brand['©acronym'].' v'.$this->App::VERSION : '')."\n";

        if ($is_wordpress && ($user = wp_get_current_user()) && $user->exists()) {
            $lines[] = __('User:').'         #'.$user->ID.' @'.$user->user_login.' \''.$user->display_name.'\'';
        }
        $lines[] = __('User IP:').'      '.($is_cli ? __('n/a; CLI process') : $this->c::currentIp());
        $lines[] = __('User Agent:').'   '.($is_cli ? __('n/a; CLI process') : ($_SERVER['HTTP_USER_AGENT'] ?? ''));
        $lines[] = __('URL:').'          '.($is_cli ? __('n/a; CLI process') : $this->c::currentUrl())."\n";

        $lines[] = $this->c::mbTrim($this->c::dump($data, true), "\r\n"); // A dump of the data (variables).

        if (is_callable($this->App->Config->©debug['©log_callback'])) {
            $this->App->Config->©debug['©log_callback'](compact('event', 'data', 'note', 'lines'));
        }
        return $this->writeLogFileLines($event, $lines); // Writes the log entry.
    }
Maybe log for debugging.

@since 160522 Debugging utilities.

@param mixed  $data  Data to log (e.g., {@link vars()}).
@param string $note  A brief note or description of the issue.
@param string $event Event name (e.g., {@link __METHOD__}).

@return int Total number of bytes written.