WooCommerce Code Reference

LoggingUtil
in package

A class of utilities for dealing with logging.

Table of Contents

generate_log_file_hash()  : string
Generate a hash to use as the suffix on a log filename.
generate_log_file_id()  : string
Generate a public ID for a log file based on its properties.
get_default_handler()  : string
Determine the current value of the default_handler setting.
get_level_threshold()  : string
Determine the current value of the level_threshold setting.
get_log_directory()  : string
Get the directory for storing log files.
get_log_directory_size()  : int
Calculate the size, in bytes, of the log directory.
get_logs_tab_url()  : string
Get the canonical URL for the Logs tab of the Status admin page.
get_retention_period()  : int
Determine the current value of the retention_period_days setting.
logging_is_enabled()  : bool
Determine the current value of the logging_enabled setting.

Methods

generate_log_file_hash()

Generate a hash to use as the suffix on a log filename.

public static generate_log_file_hash(string $file_id) : string
Parameters
$file_id : string

A file ID (file basename without the hash).

Return values
string

generate_log_file_id()

Generate a public ID for a log file based on its properties.

public static generate_log_file_id(string $source[, int|null $rotation = null ], int $created) : string

The file ID is the basename of the file without the hash part. It allows us to identify a file without revealing its full name in the filesystem, so that it's difficult to access the file directly with an HTTP request.

Parameters
$source : string

The source of the log entries contained in the file.

$rotation : int|null = null

Optional. The 0-based incremental rotation marker, if the file has been rotated. Should only be a single digit.

$created : int

Optional. The date the file was created, as a Unix timestamp.

Return values
string

get_default_handler()

Determine the current value of the default_handler setting.

public static get_default_handler() : string
Return values
string

get_level_threshold()

Determine the current value of the level_threshold setting.

public static get_level_threshold() : string
Return values
string

get_log_directory()

Get the directory for storing log files.

public static get_log_directory() : string
Return values
stringThe full directory path, with trailing slash.

get_log_directory_size()

Calculate the size, in bytes, of the log directory.

public static get_log_directory_size() : int
Return values
int

get_logs_tab_url()

Get the canonical URL for the Logs tab of the Status admin page.

public static get_logs_tab_url() : string
Return values
string

get_retention_period()

Determine the current value of the retention_period_days setting.

public static get_retention_period() : int
Return values
int

logging_is_enabled()

Determine the current value of the logging_enabled setting.

public static logging_is_enabled() : bool
Return values
bool