Constants

UPDATE_CHECK_LOG_PRIORITY

UPDATE_CHECK_LOG_PRIORITY = 10

EXECUTION_TIME_LOG_PRIORITY

EXECUTION_TIME_LOG_PRIORITY = 15

LOGS_AUTO_PURGE_LOG_PRIORITY

LOGS_AUTO_PURGE_LOG_PRIORITY = 16

COST_TRACKER_LOG_PRIORITY

COST_TRACKER_LOG_PRIORITY = 20230112

API_BACKUPS_LOG_PRIORITY

API_BACKUPS_LOG_PRIORITY = 20240130

DISABLED

DISABLED = -1

LOG

LOG = 0

WARNING

WARNING = 1

INFO

INFO = 2

DEBUG

DEBUG = 3

LOG_COLOR

LOG_COLOR = '#999999'

DEBUG_COLOR

DEBUG_COLOR = '#666666'

INFO_COLOR

INFO_COLOR = '#276f86'

WARNING_COLOR

WARNING_COLOR = '#9f3a38;'

Properties

$time_start

$time_start : integer

Private variable to hold time start.

Type

integer

$logFileNamePrefix

$logFileNamePrefix : string

Private varibale to hold the log file prefix.

Type

string — Default 'mainwp'

$logFileNameSuffix

$logFileNameSuffix : string

Private varibale to hold the log file suffix.

Type

string — Default '.log'

$logMaxMB

$logMaxMB : integer

Private varibale to hold the log file max size.

Type

integer — Default 0.5

$logDateFormat

$logDateFormat : string

Private varibale to hold the log file date format.

Type

string — Default 'Y-m-d H:i:s'

$logDirectory

$logDirectory : mixed

Private varibale to hold the log file output directory.

Type

mixed — Default null

$logPriority

$logPriority : string

Private varibale to hold the log file priotrity.

Type

string — Disabled

$logSpecific

$logSpecific : string

Private varibale to hold the log Specific priotrity.

Type

string — Disabled

$instance

$instance : mixed

Private static varibale to hold the instance.

Type

mixed — Default null

Methods

instance()

instance() : self

Method instance()

Returns new MainWP_Logger instance.

Returns

self —

MainWP_Logger

set_log_priority()

set_log_priority(mixed  $logPriority, mixed  $spec_log) 

Method set_log_priority()

Sets the log priority.

Parameters

mixed $logPriority

Log priority value.

mixed $spec_log

Specific log.

get_log_status()

get_log_status() : mixed

Method get_log_status()

Get log status.

Returns

mixed —

$enabled log status.

get_log_specific()

get_log_specific() : mixed

Method get_log_specific()

Get log specific status.

Returns

mixed —

$enabled log status.

get_log_type_info()

get_log_type_info(integer  $type, integer  $logcolor) : integer

Method get_log_type_info()

Get log type info.

Parameters

integer $type

Log type value.

integer $logcolor

Log color value.

Returns

integer —

$currentColor log color code.

debug()

debug(string  $text) : string

Method debug()

Grab debug.

Parameters

string $text

Debug message text.

Returns

string —

Log debug message.

info()

info(string  $text) : string

Method info()

Grab info.

Parameters

string $text

Info message text.

Returns

string —

Log info message.

warning()

warning(string  $text) : string

Method warning()

Grab warning information.

Parameters

string $text

Warning message text.

Returns

string —

Log warning message.

log_action()

log_action(string  $text, integer  $priority, integer  $log_color, boolean  $forced = false) : string

Method actions()

Grab actions information.

Parameters

string $text

Warning message text.

integer $priority

priority message.

integer $log_color

Set color: 0 - LOG, 1 - WARNING, 2 - INFO, 3- DEBUG.

boolean $forced

forced logging.

Returns

string —

Log warning message.

log_update_check()

log_update_check(string  $text = '') 

Method log_update_check().

Parameters

string $text

Log update check.

debug_for_website()

debug_for_website(object  $website, string  $action, string  $message) : mixed

Method debug_for_website()

Grab website debug and info.

Parameters

object $website

Child site object.

string $action

Performed action.

string $message

Debug message.

Returns

mixed —

Website debug info.

info_for_website()

info_for_website(object  $website, string  $action, string  $message) : mixed

Method info_for_website()

Grab Website Info.

Parameters

object $website

Child site object.

string $action

Performed action.

string $message

Info message.

Returns

mixed —

Website Info.

warning_for_website()

warning_for_website(object  $website, string  $action, string  $message, boolean  $addStackTrace = true) : string

Method warning_for_website()

Grab Website Warnings.

Parameters

object $website

Child site object.

string $action

Performed action.

string $message

Warning message.

boolean $addStackTrace

Add or Don't add stack trace.

Returns

string —

Website warnings.

prepare_log_info()

prepare_log_info(mixed  $data) : mixed

Method prepare_log_info()

Prepare log data.

Parameters

mixed $data

Log data.

Returns

mixed —

$data filtered data.

prepend()

prepend(mixed  $str, mixed  $filename) 

Method prepend()

Prepend content to log file.

Parameters

mixed $str

Custom string.

mixed $filename

Filename.

init_execution_time()

init_execution_time(string  $time_index = '') 

Method init_execution_time().

Parameters

string $time_index

index for timer.

Init execution time start value.

log_execution_time()

log_execution_time(string  $text = '') 

Method log_execution_time().

Parameters

string $text

Log record text.

Log the execution time value.

get_log_file()

get_log_file() : mixed

Method get_log_file()

Grab Log File.

Returns

mixed —

Log File.

get_log_text()

get_log_text(mixed  $priority) : string

Method get_log_text()

Grab what type of log entry.

Parameters

mixed $priority

Set priority.

Returns

string —

LOG -OR- DISABLED|DEBUG|INFO|WARNING|INFO UPDATE

check_log_daily()

check_log_daily() 

Method check_log_daily()

Daily checks to clear the log file.

clear_log_db()

clear_log_db() 

Method clear_log_db()

Clear the log file.

clear_log()

clear_log() 

Method clear_log()

Clear the log file.

show_log_db()

show_log_db() 

Method show_log_db()

Grab log file and build output to screen.

show_log_file()

show_log_file() 

Method show_log_file()

Grab log file and build output to screen.

__construct()

__construct() 

MainWP_Logger constructor.

Run each time the class is called.

log_to_db()

log_to_db(string  $text, integer  $priority, integer  $log_color, boolean  $forced = false, mixed  $website = false) : boolean

Method log_to_db()

Log to database.

Parameters

string $text

Log record text.

integer $priority

Set priority.

integer $log_color

Set color.

boolean $forced

forced logging.

mixed $website

website object.

Returns

boolean —

true|false Default is False.

log()

log(string  $text, integer  $priority, integer  $log_color, boolean  $forced = false, mixed  $website = false) : boolean

Method log()

Create Log File.

Parameters

string $text

Log record text.

integer $priority

Set priority.

integer $log_color

Set color.

boolean $forced

forced logging.

mixed $website

Site object.

Returns

boolean —

true|false Default is False.

get_execution_time()

get_execution_time(string  $time_index = '') : integer

Method get_execution_time().

Get the execution time value.

Parameters

string $time_index

Index for timer.

Returns

integer —

execution time.