Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
eZDebug Class Reference
Utility classes

Advanced debug/log system. More...

## Public Member Functions
| __construct ()
| reset ()
| messageName ( $messageType)
| recursionProtectErrorHandler ( $errno, $errstr, $errfile, $errline)
| errorHandler ( $errno, $errstr, $errfile, $errline)
| setMessageOutput ( $output)
| setStoreLog ( $store)
| isLogFileEnabled ( $type)
| isGlobalLogFileEnabled ()
| setIsLogFileEnabled ( $type, $enabled)
| setIsGlobalLogFileEnabled ( $enabled)
| setLogOnly ( $enabled)
| messageTypes ()
| logFiles ()
| isDebugAllowed ()

## Static Public Member Functions
static | instance ()
static | showMessage ( $type)
static | alwaysLogMessage ( $level)
static | setHandleType ( $type)
static | showTypes ( $types=false)
static | writeStrict ( $string, $label="", $backgroundClass="")
static | writeNotice ( $string, $label="", $backgroundClass="")
static | writeWarning ( $string, $label="", $backgroundClass="")
static | writeError ( $string, $label="", $backgroundClass="")
static | writeDebug ( $string, $label="", $backgroundClass="")
static | setUseExternalCSS ( $use)
static | addTimingPoint ( $description="")
static | maxLogSize ()
static | setMaxLogSize ( $size)
static | maxLogrotateFiles ()
static | setLogrotateFiles ( $files)
static | rotateLog ( $fileName)
static | setLogFileEnabled ( $enabled, $types=false)
static | isDebugEnabled ()
static | isLogOnlyEnabled ()
static | isIPInNet ( $ipaddress, $network, $mask=24)
static | updateSettings ( $settings)
static | checkDebugByUser ()
static | printReport ( $newWindow=false, $as_html=true, $returnReport=false, $allowedDebugLevels=false, $useAccumulators=true, $useTiming=true, $useIncludedFiles=false)
static | setScriptStart ( $time=false)
static | setScriptStop ( $time=false)
static | createAccumulatorGroup ( $key, $name=false)
static | createAccumulator ( $key, $inGroup=false, $name=false)
static | accumulatorStart ( $key, $inGroup=false, $name=false, $recursive=false)
static | accumulatorStop ( $key, $recursive=false)
static | appendTopReport ( $reportName, $reportContent)
static | printTopReportsList ()
static | appendBottomReport ( $reportName, $reportContent)
static | printBottomReportsList ( $as_html=true)
static | exceptionErrorHandler ( $errno, $errstr, $errfile, $errline)

## Public Attributes
| $StoreLog
const | LEVEL_NOTICE = 1
const | LEVEL_WARNING = 2
const | LEVEL_ERROR = 3
const | LEVEL_TIMING_POINT = 4
const | LEVEL_DEBUG = 5
const | LEVEL_STRICT = 6
const | SHOW_NOTICE = 1
const | SHOW_WARNING = 2
const | SHOW_ERROR = 4
const | SHOW_TIMING_POINT = 8
const | SHOW_DEBUG = 16
const | SHOW_STRICT = 32
const | SHOW_ALL = 63
const | HANDLE_NONE = 0
const | HANDLE_FROM_PHP = 1
const | HANDLE_TO_PHP = 2
const | HANDLE_EXCEPTION = 3
const | OUTPUT_MESSAGE_SCREEN = 1
const | OUTPUT_MESSAGE_STORE = 2
const | MAX_LOGFILE_SIZE = 204800
const | MAX_LOGROTATE_FILES = 3
const | XDEBUG_SIGNATURE = '--XDEBUG--'
| $DebugStrings = array()
| $TimePoints = array()
| Array which contains the time points. More...
| $TmpTimePoints
| Array which contains the temporary time points. More...
| $TimeAccumulatorList = array()
| Array wich contains time accumulators. More...
| $ShowTypes
| Determines which debug messages should be shown. More...
| $HandleType
| Determines what to do with php errors, ignore, fetch or output. More...
| $OutputFormat
| An array of the outputformats for the different debug levels. More...
| $LogFiles
| An array of logfiles used by the debug class with each key being the debug level. More...
| $TimingAccuracy = 4
| How many places behind . should be displayed when showing times. More...
| $PercentAccuracy = 4
| How many places behind . should be displayed when showing percentages. More...
| $UseCSS
| Whether to use external CSS or output own CSS. True if external is to be used. More...
| $MessageOutput
| Determines how messages are output (screen/log) More...
| $MessageTypes
| A list of message types. More...
| $LogFileEnabled
| A map with message types and whether they should do file logging. More...
| $GlobalLogFileEnabled
| Controls whether logfiles are used at all. More...
| $ScriptStart
| The time when the script was started. More...
| $ScriptStop
| $OverrideList
| A list of override directories. More...
| $bottomReportsList
| A list of debug reports that appears at the bottom of debug output. More...
| $topReportsList
| A list of debug reports that appears at the top of debug output. More...
| $MessageNames
| $AlwaysLog
| $OldHandler
| $TimeAccumulatorGroupList

## Private Member Functions
| write ( $string, $verbosityLevel=self::LEVEL_NOTICE, $label="", $backgroundClass="", $alwaysLog=false)
| writeFile (&$logFileData, &$string, $verbosityLevel, $alwaysLog=false)
| printReportInternal ( $as_html=true, $returnReport=true, $allowedDebugLevels=false, $useAccumulators=true, $useTiming=true, $useIncludedFiles=false)

## Static Private Member Functions
static | dumpVariable ( $var)
static | isIPInNetIPv6 ( $ipAddress, $ipAddressRange)
static | packedToBin ( $packedIPAddress)
static | isAllowedByCurrentIP ( $allowedIpList)

## Private Attributes
| $recursionFlag = false

## Detailed Description

Advanced debug/log system.

The eZ debug library is used to handle debug information. It can display information on screen and/or write it to log files.

You can enable on-screen debug information for specific IP addresses.

Timing points can be placed in the code to time the different sections of code.

Each debug message can be turned on/off by using the showTypes() function.

PHP error messages can also be shown using setHandleType().

// write a temporary debug message
eZDebug::writeDebug( "Test" );
// write a notice
eZDebug::writeNotice( "Image found" );
// write a warning
eZDebug::writeWarning( "Image not found, using default" );
// write an error
eZDebug::writeError( "Object not found, bailing.." );
// add a timing points
eZDebug::addTimingPoint( "Module Found" );
//.... code
eZDebug::addTimingPoint( "Module loading" );
// print the results on screen.
eZDebug::printReport();
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:546
eZDebug\printReport
static printReport( $newWindow=false, $as_html=true, $returnReport=false, $allowedDebugLevels=false, $useAccumulators=true, $useTiming=true, $useIncludedFiles=false)
Definition: ezdebug.php:1225
eZDebug\writeDebug
static writeDebug( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:589
eZDebug\writeNotice
static writeNotice( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:460
eZDebug\writeWarning
static writeWarning( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:503
eZDebug\addTimingPoint
static addTimingPoint( $description="")
Definition: ezdebug.php:677

Definition at line 57 of file ezdebug.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZDebug::__construct | ( |  | ) |

Creates a new debug object.

Definition at line 91 of file ezdebug.php.

References HANDLE_NONE, OUTPUT_MESSAGE_STORE, and SHOW_ALL.

## Member Function Documentation

## ◆ accumulatorStart()

static eZDebug::accumulatorStart | ( |  | $key,
|  |  | $inGroup = `false`,
|  |  | $name = `false`,
|  |  | $recursive = `false`
| ) |  |
| static

Starts an time count for the accumulator $key. You can also specify a name which will be displayed.

Definition at line 1362 of file ezdebug.php.

References $debug, $name, $startTime, instance(), and isDebugEnabled().

Referenced by eZDFSFileHandlerMySQLiBackend\_checkCacheGenerationTimeout(), eZDFSFileHandlerMySQLiBackend\_connect(), eZDFSFileHandlerMySQLiBackend\_query(), eZDFSFileHandlerMySQLiBackend\_selectOne(), eZDFSFileHandlerDFSBackend\accumulatorStart(), eZTextCodec\convertCodepage(), eZTextCodec\convertCodepageMapper(), eZTextCodec\convertCodepageRev(), eZTextCodec\convertCodepageToUnicode(), eZTextCodec\convertMBString(), eZTextCodec\convertString(), eZTextCodec\convertUnicodeToCodepage(), eZTextCodec\convertUnicodeToUTF8(), eZTextCodec\convertUTF8ToUnicode(), eZFSFileHandler\delete(), eZFSFileHandler\fetchContents(), eZFSFileHandler\fileCopy(), eZFSFileHandler\fileDelete(), eZFSFileHandler\fileDeleteByDirList(), eZFSFileHandler\fileDeleteByWildcard(), eZFSFileHandler\fileExists(), eZFSFileHandler\fileFetchContents(), eZFSFileHandler\fileLinkCopy(), eZFSFileHandler\fileMove(), eZFSFileHandler\fileStoreContents(), eZTSTranslator\initialize(), eZFSFileHandler\loadMetaData(), eZTSTranslator\loadTranslationFile(), eZFSFileHandler\move(), eZFSFileHandler\passthrough(), and eZFSFileHandler\storeContents().

## ◆ accumulatorStop()

static eZDebug::accumulatorStop | ( |  | $key,
|  |  | $recursive = `false`
| ) |  |
| static

Stops a previous time count and adds the total time to the accumulator $key.

Definition at line 1390 of file ezdebug.php.

References $debug, $stopTime, instance(), isDebugEnabled(), and writeWarning().

Referenced by eZDFSFileHandlerMySQLiBackend\_connect(), eZDFSFileHandlerMySQLiBackend\_query(), eZDFSFileHandlerMySQLiBackend\_selectOne(), eZDFSFileHandlerDFSBackend\accumulatorStop(), eZTextCodec\convertCodepage(), eZTextCodec\convertCodepageMapper(), eZTextCodec\convertCodepageRev(), eZTextCodec\convertCodepageToUnicode(), eZTextCodec\convertMBString(), eZTextCodec\convertString(), eZTextCodec\convertUnicodeToCodepage(), eZTextCodec\convertUnicodeToUTF8(), eZTextCodec\convertUTF8ToUnicode(), eZFSFileHandler\delete(), eZFSFileHandler\fetchContents(), eZFSFileHandler\fileCopy(), eZFSFileHandler\fileDelete(), eZFSFileHandler\fileDeleteByDirList(), eZFSFileHandler\fileDeleteByWildcard(), eZFSFileHandler\fileExists(), eZFSFileHandler\fileFetchContents(), eZFSFileHandler\fileLinkCopy(), eZFSFileHandler\fileMove(), eZFSFileHandler\fileStoreContents(), eZTSTranslator\initialize(), eZFSFileHandler\loadMetaData(), eZTSTranslator\loadTranslationFile(), eZFSFileHandler\move(), eZFSFileHandler\passthrough(), and eZFSFileHandler\storeContents().

## ◆ addTimingPoint()

static eZDebug::addTimingPoint | ( |  | $description = `""` | ) |
| static

Adds a new timing point for the benchmark report.

Definition at line 677 of file ezdebug.php.

References $debug, $desc, $file, $files, $time, instance(), isDebugEnabled(), and showMessage().

Referenced by eZDebugSetting\addTimingPoint(), ezpbKernelAdmin\dispatchLoop(), ezpbKernelWeb\dispatchLoop(), ezpKernelWeb\dispatchLoop(), ezpbKernelAdmin\redirect(), ezpbKernelWeb\redirect(), ezpKernelWeb\redirect(), ezpbKernelAdmin\requestInit(), ezpbKernelWeb\requestInit(), ezpKernelWeb\requestInit(), ezpbKernelAdmin\run(), ezpbKernelWeb\run(), and ezpKernelWeb\run().

## ◆ alwaysLogMessage()

static eZDebug::alwaysLogMessage | ( |  | $level | ) |
| static

Returns
  `true` if the debug level $level should always log to file.

Definition at line 224 of file ezdebug.php.

References $instance, $level, and instance().

Referenced by writeDebug(), writeError(), writeNotice(), writeStrict(), and writeWarning().

## ◆ appendBottomReport()

static eZDebug::appendBottomReport | ( |  | $reportName,
|  |  | $reportContent
| ) |  |
| static

Appends report to 'bottom' reports list.

Definition at line 1876 of file ezdebug.php.

References $debug, and instance().

Referenced by eZDisplayDebug().

## ◆ appendTopReport()

static eZDebug::appendTopReport | ( |  | $reportName,
|  |  | $reportContent
| ) |  |
| static

Appends report to 'top' reports list.

Definition at line 1854 of file ezdebug.php.

References $debug, and instance().

Referenced by eZDisplayDebug().

## ◆ checkDebugByUser()

static eZDebug::checkDebugByUser | ( |  | ) |
| static

Final checking for debug by user id. Checks if we should enable debug.

Returns false if debug-by-user is not active, was already checked before or if there is no current user. Returns true otherwise.

Definition at line 1185 of file ezdebug.php.

References $currentUserID.

Referenced by ezpbKernelAdmin\requestInit(), ezpbKernelWeb\requestInit(), and ezpKernelWeb\requestInit().

## ◆ createAccumulator()

static eZDebug::createAccumulator | ( |  | $key,
|  |  | $inGroup = `false`,
|  |  | $name = `false`
| ) |  |
| static

Creates a new accumulator entry if one does not already exist and initializes with default data. If $name is not supplied name is taken from $key. If $inGroup is supplied it will place the accumulator under the specified group.

Definition at line 1334 of file ezdebug.php.

References $debug, $name, instance(), and isDebugEnabled().

## ◆ createAccumulatorGroup()

static eZDebug::createAccumulatorGroup | ( |  | $key,
|  |  | $name = `false`
| ) |  |
| static

Creates an accumulator group with key $key and group name $name. If $name is not supplied name is taken from $key.

Definition at line 1315 of file ezdebug.php.

References $debug, $name, instance(), and isDebugEnabled().

Referenced by eZTSTranslator\initialize().

## ◆ dumpVariable()

static eZDebug::dumpVariable | ( |  | $var | ) |
| static private

Dumps the variables contents using the var_dump function

Definition at line 630 of file ezdebug.php.

References XDEBUG_SIGNATURE.

Referenced by writeDebug(), writeError(), writeNotice(), writeStrict(), and writeWarning().

## ◆ errorHandler()

eZDebug::errorHandler | ( |  | $errno,
|  |  | $errstr,
|  |  | $errfile,
|  |  | $errline
| ) |  |

Handles PHP errors, creates notice, warning and error messages for the various PHP error types.

Definition at line 330 of file ezdebug.php.

References $str, isDebugEnabled(), writeError(), writeNotice(), writeStrict(), and writeWarning().

Referenced by recursionProtectErrorHandler().

## ◆ exceptionErrorHandler()

static eZDebug::exceptionErrorHandler | ( |  | $errno,
|  |  | $errstr,
|  |  | $errfile,
|  |  | $errline
| ) |  |
| static

Exception based error handler, very basic

Since
  4.5

Exceptions

  ErrorException |

Definition at line 1987 of file ezdebug.php.

## ◆ instance()

static eZDebug::instance | ( |  | ) |
| static

Returns a shared instance of the eZDebug class.

Returns
  eZDebug

Definition at line 202 of file ezdebug.php.

Referenced by ezpRestDebug\__construct(), accumulatorStart(), accumulatorStop(), addTimingPoint(), alwaysLogMessage(), appendBottomReport(), appendTopReport(), createAccumulator(), createAccumulatorGroup(), eZDebugSetting\isConditionTrue(), printBottomReportsList(), printReport(), printTopReportsList(), setHandleType(), setLogFileEnabled(), setScriptStart(), setScriptStop(), setUseExternalCSS(), showMessage(), showTypes(), writeDebug(), writeError(), writeNotice(), writeStrict(), and writeWarning().

## ◆ isAllowedByCurrentIP()

static eZDebug::isAllowedByCurrentIP | ( |  | $allowedIpList | ) |
| static private

If debugging is allowed for the current IP address.

Parameters

  array | $allowedIpList |

Returns
  bool

Definition at line 1919 of file ezdebug.php.

References eZSys\clientIP(), and eZSys\isShellExecution().

## ◆ isDebugAllowed()

eZDebug::isDebugAllowed | ( |  | ) |

If debugging is allowed, given the limitations of the DebugByIP and DebugByUser settings.

Definition at line 1908 of file ezdebug.php.

## ◆ isDebugEnabled()

static eZDebug::isDebugEnabled | ( |  | ) |
| static

Returns
  true if debug should be enabled.

Note
  Will return false until the real settings has been updated with updateSettings()

Definition at line 1028 of file ezdebug.php.

Referenced by accumulatorStart(), accumulatorStop(), addTimingPoint(), createAccumulator(), createAccumulatorGroup(), eZExecution\defaultExceptionHandler(), errorHandler(), ezpbKernelAdmin\setupFatalErrorHandler(), ezpbKernelWeb\setupFatalErrorHandler(), ezpKernelWeb\setupFatalErrorHandler(), write(), writeDebug(), writeError(), writeFile(), writeNotice(), writeStrict(), and writeWarning().

## ◆ isGlobalLogFileEnabled()

eZDebug::isGlobalLogFileEnabled | ( |  | ) |

Returns
  true if the message type $type has logging to file enabled.

See also
  isLogFileEnabled, setIsGlobalLogFileEnabled

Definition at line 975 of file ezdebug.php.

References $GlobalLogFileEnabled.

Referenced by isLogFileEnabled().

## ◆ isIPInNet()

static eZDebug::isIPInNet | ( |  | $ipaddress,
|  |  | $network,
|  |  | $mask = `24`
| ) |  |
| static

Determine if an ipaddress is in a network. E.G. 120.120.120.120 in 120.120.0.0/24.

Returns
  true or false.

Definition at line 1058 of file ezdebug.php.

## ◆ isIPInNetIPv6()

static eZDebug::isIPInNetIPv6 | ( |  | $ipAddress,
|  |  | $ipAddressRange
| ) |  |
| static private

Determine if an IPv6 ipaddress is in a network. E.G. 2620:0:860:2:: in 2620:0:860:2::/64

Parameters

  string | $ipAddress | IP Address
  string | $ipAddressRange | IP Address Range

Returns
  bool Returns true if address is in the network and false if not in the network

Definition at line 1076 of file ezdebug.php.

## ◆ isLogFileEnabled()

eZDebug::isLogFileEnabled | ( |  | $type | ) |

Returns
  true if the message type $type has logging to file enabled.

See also
  isGlobalLogFileEnabled, setIsLogFileEnabled

Definition at line 964 of file ezdebug.php.

References $type, and isGlobalLogFileEnabled().

Referenced by write(), and writeFile().

## ◆ isLogOnlyEnabled()

static eZDebug::isLogOnlyEnabled | ( |  | ) |
| static

Returns
  true if there should only be logging of debug strings to file.

Note
  Will return false until the real settings has been updated with updateSettings()

Definition at line 1043 of file ezdebug.php.

Referenced by write().

## ◆ logFiles()

eZDebug::logFiles | ( |  | ) |

Returns an associative array of all the log files used by this class where each key is the debug level (self::LEVEL_NOTICE, self::LEVEL_WARNING or self::LEVEL_ERROR or self::LEVEL_DEBUG).

Definition at line 1018 of file ezdebug.php.

References $LogFiles.

Referenced by write().

## ◆ maxLogrotateFiles()

static eZDebug::maxLogrotateFiles | ( |  | ) |
| static

Returns
  the maxium number of logrotate files to keep.

Definition at line 813 of file ezdebug.php.

References MAX_LOGROTATE_FILES, and setLogrotateFiles().

Referenced by rotateLog().

## ◆ maxLogSize()

static eZDebug::maxLogSize | ( |  | ) |
| static

Returns
  the maxium size for a log file in bytes.

Definition at line 786 of file ezdebug.php.

References MAX_LOGFILE_SIZE, and setMaxLogSize().

Referenced by writeFile().

## ◆ messageName()

eZDebug::messageName | ( |  | $messageType | ) |

Returns
  the name of the message type.

Definition at line 192 of file ezdebug.php.

## ◆ messageTypes()

eZDebug::messageTypes | ( |  | ) |

Returns
  an array with the available message types.

Definition at line 1009 of file ezdebug.php.

References $MessageTypes.

## ◆ packedToBin()

static eZDebug::packedToBin | ( |  | $packedIPAddress | ) |
| static private

Turns the 'packed' output of inet_pton into a full binary representation

Parameters

  string | $packedIPAddress | Packed ip address in binary string form

Returns
  string Returns binary string representation

Definition at line 1094 of file ezdebug.php.

## ◆ printBottomReportsList()

static eZDebug::printBottomReportsList | ( |  | $as_html = `true` | ) |
| static

Loop over all bottom reports and if callable call them with $as_html parameter, if not output as is (string).

Parameters

  bool | $as_html |

Definition at line 1888 of file ezdebug.php.

References $debug, and instance().

Referenced by printReportInternal().

## ◆ printReport()

static eZDebug::printReport | ( |  | $newWindow = `false`,
|  |  | $as_html = `true`,
|  |  | $returnReport = `false`,
|  |  | $allowedDebugLevels = `false`,
|  |  | $useAccumulators = `true`,
|  |  | $useTiming = `true`,
|  |  | $useIncludedFiles = `false`
| ) |  |
| static

Prints the debug report

Definition at line 1225 of file ezdebug.php.

References $debug, $header, ezpEvent\getInstance(), instance(), eZDir\path(), eZURI\transformURI(), and eZSys\varDirectory().

Referenced by eZDisplayDebug().

## ◆ printReportInternal()

eZDebug::printReportInternal | ( |  | $as_html = `true`,
|  |  | $returnReport = `true`,
|  |  | $allowedDebugLevels = `false`,
|  |  | $useAccumulators = `true`,
|  |  | $useTiming = `true`,
|  |  | $useIncludedFiles = `false`
| ) |  |
| private

Prints a full debug report with notice, warnings, errors and a timing report.

Definition at line 1425 of file ezdebug.php.

References $contents, $debug, $group, $groupList, $groups, $i, $ini, $name, $ScriptStart, $ScriptStop, $startTime, $time, $TimeAccumulatorGroupList, $TimeAccumulatorList, $type, printBottomReportsList(), and printTopReportsList().

Referenced by ezpRestDebug\getReport().

## ◆ printTopReportsList()

static eZDebug::printTopReportsList | ( |  | ) |
| static

Prints all 'top' reports

Definition at line 1863 of file ezdebug.php.

References $debug, and instance().

Referenced by printReportInternal().

## ◆ recursionProtectErrorHandler()

eZDebug::recursionProtectErrorHandler | ( |  | $errno,
|  |  | $errstr,
|  |  | $errfile,
|  |  | $errline
| ) |  |

Definition at line 310 of file ezdebug.php.

References $result, and errorHandler().

## ◆ reset()

eZDebug::reset | ( |  | ) |

Definition at line 175 of file ezdebug.php.

## ◆ rotateLog()

static eZDebug::rotateLog | ( |  | $fileName | ) |
| static

Rotates logfiles so the current logfile is backed up, old rotate logfiles are rotated once more and those that exceed maxLogrotateFiles() will be removed. Rotated files will get the extension .1, .2 etc.

Definition at line 843 of file ezdebug.php.

References $fileName, $i, file_exists(), maxLogrotateFiles(), and eZFile\rename().

Referenced by writeFile().

## ◆ setHandleType()

static eZDebug::setHandleType | ( |  | $type | ) |
| static

Determines how PHP errors are handled. If $type is self::HANDLE_TO_PHP all error messages is sent to PHP using trigger_error(), if $type is self::HANDLE_FROM_PHP all error messages from PHP is fetched using a custom error handler and output as a usual eZDebug message. If $type is self::HANDLE_NONE there is no error exchange between PHP and eZDebug.

Definition at line 248 of file ezdebug.php.

References $instance, $type, HANDLE_EXCEPTION, HANDLE_FROM_PHP, HANDLE_NONE, HANDLE_TO_PHP, and instance().

Referenced by ezpbKernelAdmin\__construct(), ezpbKernelWeb\__construct(), ezpKernelTreeMenu\__construct(), ezpKernelWeb\__construct(), ezpKernelRest\__construct(), updateSettings(), and writeFile().

## ◆ setIsGlobalLogFileEnabled()

eZDebug::setIsGlobalLogFileEnabled | ( |  | $enabled | ) |

Sets whether logfiles are enabled or disabled globally. Sets the value to $enabled.

See also
  isLogFileEnabled, isGlobalLogFileEnabled

Definition at line 993 of file ezdebug.php.

## ◆ setIsLogFileEnabled()

eZDebug::setIsLogFileEnabled | ( |  | $type,
|  |  | $enabled
| ) |  |

Sets whether the logfile $type is enabled or disabled to $enabled.

See also
  isLogFileEnabled

Definition at line 984 of file ezdebug.php.

References $type.

## ◆ setLogFileEnabled()

static eZDebug::setLogFileEnabled | ( |  | $enabled,
|  |  | $types = `false`
| ) |  |
| static

Enables or disables logging to file for a given message type. If $types is not supplied it will do the operation for all types.

Definition at line 943 of file ezdebug.php.

References $instance, $type, $types, and instance().

Referenced by writeFile().

## ◆ setLogOnly()

eZDebug::setLogOnly | ( |  | $enabled | ) |

Sets whether debug output should be logged only

Definition at line 1001 of file ezdebug.php.

## ◆ setLogrotateFiles()

static eZDebug::setLogrotateFiles | ( |  | $files | ) |
| static

Sets the maxium number of logrotate files to keep to $files.

Definition at line 831 of file ezdebug.php.

References $files.

Referenced by maxLogrotateFiles().

## ◆ setMaxLogSize()

static eZDebug::setMaxLogSize | ( |  | $size | ) |
| static

Sets the maxium size for a log file to $size.

Definition at line 804 of file ezdebug.php.

References $size.

Referenced by maxLogSize().

## ◆ setMessageOutput()

eZDebug::setMessageOutput | ( |  | $output | ) |

Determines the way messages are output, the $output parameter is self::OUTPUT_MESSAGE_SCREEN and self::OUTPUT_MESSAGE_STORE ored together.

Definition at line 664 of file ezdebug.php.

References $output.

## ◆ setScriptStart()

static eZDebug::setScriptStart | ( |  | $time = `false` | ) |
| static

Sets the time of the start of the script ot $time. If $time is not supplied it gets the current `microtime( true )`. This is used to calculate total execution time and percentages.

Definition at line 1290 of file ezdebug.php.

References $debug, $time, and instance().

Referenced by ezpbKernelAdmin\requestInit(), ezpbKernelWeb\requestInit(), and ezpKernelWeb\requestInit().

## ◆ setScriptStop()

static eZDebug::setScriptStop | ( |  | $time = `false` | ) |
| static

Sets the time of the stop of the script ot $time. If $time is not supplied it gets the current `microtime( true )`. This is used to calculate total execution time and percentages.

Definition at line 1303 of file ezdebug.php.

References $debug, $time, and instance().

Referenced by eZDisplayDebug().

## ◆ setStoreLog()

eZDebug::setStoreLog | ( |  | $store | ) |

Definition at line 669 of file ezdebug.php.

## ◆ setUseExternalCSS()

static eZDebug::setUseExternalCSS | ( |  | $use | ) |
| static

Enables/disables the use of external CSS. If false a <style> tag is output before the debug list. Default is to use internal css.

Definition at line 655 of file ezdebug.php.

References instance().

Referenced by ezpKernelWeb\run().

## ◆ showMessage()

static eZDebug::showMessage | ( |  | $type | ) |
| static

Returns true if the message type $type can be shown.

Definition at line 215 of file ezdebug.php.

References $debug, $type, and instance().

Referenced by addTimingPoint(), writeDebug(), writeError(), writeNotice(), writeStrict(), and writeWarning().

## ◆ showTypes()

static eZDebug::showTypes | ( |  | $types = `false` | ) |
| static

Sets types to be shown to $types and returns the old show types. If $types is not supplied the current value is returned and no change is done. $types is one or more of self::SHOW_NOTICE, self::SHOW_WARNING, self::SHOW_ERROR, self::SHOW_TIMING_POINT or'ed together.

Definition at line 297 of file ezdebug.php.

References $instance, $types, and instance().

## ◆ updateSettings()

static eZDebug::updateSettings | ( |  | $settings | ) |
| static

Updates the settings for debug handling with the settings array $settings. The array must contain the following keys.

- debug-enabled - boolean which controls debug handling
- debug-by-ip - boolean which controls IP controlled debugging
- debug-ip-list - array of IPs which gets debug
- debug-by-user - boolean which controls userID controlled debugging
- debug-user-list - array of UserIDs which gets debug

Definition at line 1133 of file ezdebug.php.

References setHandleType().

Referenced by eZUpdateDebugSettings(), and ezpRestDebug\updateDebugSettings().

## ◆ write()

eZDebug::write | ( |  | $string,
|  |  | $verbosityLevel = `self::LEVEL_NOTICE`,
|  |  | $label = `""`,
|  |  | $backgroundClass = `""`,
|  |  | $alwaysLog = `false`
| ) |  |
| private

Writes a debug log message.

Definition at line 716 of file ezdebug.php.

References $desc, $fileName, $files, eZSys\clientIP(), isDebugEnabled(), isLogFileEnabled(), isLogOnlyEnabled(), LEVEL_DEBUG, LEVEL_ERROR, LEVEL_NOTICE, LEVEL_STRICT, LEVEL_TIMING_POINT, LEVEL_WARNING, logFiles(), eZSys\serverVariable(), and writeFile().

## ◆ writeDebug()

static eZDebug::writeDebug | ( |  | $string,
|  |  | $label = `""`,
|  |  | $backgroundClass = `""`
| ) |  |
| static

Writes a debug message.

The global variable `'eZDebugDebug'` will be set to `true` if the notice is added.

Parameters

  $label | This label will be associated with the notice, e.g. to say where the notice came from.

Definition at line 589 of file ezdebug.php.

References $debug, alwaysLogMessage(), dumpVariable(), instance(), isDebugEnabled(), and showMessage().

Referenced by eZDFSFileHandlerMySQLiBackend\_startCacheGeneration(), eZSQLite3DB\connect(), eZCodePageMapper\load(), and eZDebugSetting\writeDebug().

## ◆ writeError()

static eZDebug::writeError | ( |  | $string,
|  |  | $label = `""`,
|  |  | $backgroundClass = `""`
| ) |  |
| static

Writes a debug error.

The global variable `'eZDebugError'` will be set to `true` if the notice is added.

Parameters

  $label | This label will be associated with the notice, e.g. to say where the notice came from.

Definition at line 546 of file ezdebug.php.

References $debug, alwaysLogMessage(), dumpVariable(), instance(), isDebugEnabled(), and showMessage().

Referenced by eZMBStringMapper\__construct(), eZTextCodec\__construct(), eZDFSFileHandlerMySQLiBackend\_deleteByDirListInner(), eZDFSFileHandlerMySQLiBackend\_die(), eZDFSFileHandlerMySQLiBackend\_endCacheGeneration(), eZDFSFileHandlerMySQLiBackend\_error(), eZDFSFileHandlerMySQLiBackend\_fetch(), eZDFSFileHandlerMySQLiBackend\_fetchContents(), eZDFSFileHandlerMySQLiBackend\_getFileList(), eZDFSFileHandlerMySQLiBackend\_handleErrorType(), eZDFSFileHandlerMySQLiBackend\_protect(), eZDFSFileHandlerMySQLiBackend\_rename(), eZDFSFileHandlerMySQLiBackend\_selectOne(), eZDFSFileHandlerMySQLiBackend\_startCacheGeneration(), eZDFSFileHandlerMySQLiBackend\_store(), eZExtension\activeExtensions(), eZContentLanguage\addLanguage(), eZSys\attribute(), eZURI\attribute(), eZPersistentObject\attribute(), ezpRestClient\attribute(), eZExecution\cleanup(), eZFileHandler\close(), eZPersistentObject\conditionTextByRow(), eZSQLite3DB\connect(), eZDir\copy(), eZFileHandler\copy(), eZDFSFileHandlerDFSBackend\copyToDFS(), ezpAttributeOperatorManager\createFormatter(), eZCodeMapper\decodeCommand(), eZFSFileHandler\delete(), ezpbKernelAdmin\dispatchLoop(), ezpbKernelWeb\dispatchLoop(), ezpKernelWeb\dispatchLoop(), eZGZIPZLIBCompressionHandler\doSeek(), eZFile\downloadContent(), eZFile\downloadHeaders(), eZDFSFileHandler\endCacheGeneration(), eZSys\environmentVariable(), eZFileHandler\eof(), eZCodeMapper\error(), errorHandler(), eZCodeMapper\executeCommandCode(), eZCodeMapper\expandInheritance(), eZContentLanguage\fetchList(), eZFSFileHandler\fileDelete(), eZFileHandler\flush(), eZCodeMapper\generateCharsetMappingTable(), eZCodeMapper\generateCommandCode(), eZSession\get(), eZExtension\getHandlerClass(), ezpExtension\getInfo(), ezpExtension\getLoadingOrder(), eZCharTransform\groupCommands(), eZTSTranslator\handleContextNode(), eZTSTranslator\handleMessageNode(), ezpMobileDeviceDetect\isEnabled(), eZFileHandler\link(), eZCodePageMapper\load(), eZSiteAccess\match(), eZFileHandler\move(), eZFileHandler\open(), eZFileHandler\passtrough(), eZURLAliasFilterAppendNodeID\process(), eZFSFileHandler\processCache(), eZDFSFileHandler\processCache(), eZFileHandler\read(), eZDir\recursiveDelete(), eZTranslatorGroup\registerHandler(), eZFileHandler\rewind(), ezpKernelWeb\run(), eZFileHandler\seek(), eZSys\serverVariable(), eZPersistentObject\setAttribute(), eZCodePageMapper\setSubstituteCharacter(), eZDFSFileHandler\startCacheGeneration(), eZDFSFileHandler\storeCache(), eZFSFileHandler\storeCache(), eZFileHandler\symlink(), eZFileHandler\tell(), eZExecution\uncleanShutdownHandler(), eZFileHandler\unlink(), eZFileHandler\write(), eZLog\write(), eZDebugSetting\writeError(), writeFile(), and eZLog\writeStorageLog().

## ◆ writeFile()

eZDebug::writeFile | ( | & | $logFileData,
|  | & | $string,
|  |  | $verbosityLevel,
|  |  | $alwaysLog = `false`
| ) |  |
| private

Writes the log message $string to the file $fileName.

Definition at line 879 of file ezdebug.php.

References $fileName, $ini, $time, eZSys\clientIP(), file_exists(), isDebugEnabled(), isLogFileEnabled(), maxLogSize(), eZDir\mkdir(), rotateLog(), eZSys\serverVariable(), setHandleType(), setLogFileEnabled(), and writeError().

Referenced by write().

## ◆ writeNotice()

static eZDebug::writeNotice | ( |  | $string,
|  |  | $label = `""`,
|  |  | $backgroundClass = `""`
| ) |  |
| static

Writes a debug notice.

The global variable `'eZDebugNotice'` will be set to `true` if the notice is added.

Parameters

  $label | This label will be associated with the notice, e.g. to say where the notice came from.
  $backgroundClass | A string defining the class to use in the HTML debug output.

Definition at line 460 of file ezdebug.php.

References $debug, alwaysLogMessage(), dumpVariable(), instance(), isDebugEnabled(), and showMessage().

Referenced by eZDFSFileHandlerMySQLiBackend\_report(), ezpContentPublishingQueueProcessor\cleanupFinishedProcesses(), errorHandler(), eZExtension\getHandlerClass(), and eZDebugSetting\writeNotice().

## ◆ writeStrict()

static eZDebug::writeStrict | ( |  | $string,
|  |  | $label = `""`,
|  |  | $backgroundClass = `""`
| ) |  |
| static

Writes a strict debug message.

The global variable `'eZDebugStrict'` will be set to `true` if the notice is added.

Parameters

  $label | This label will be associated with the strict message, e.g. to say where the message came from.
  $backgroundClass | A string defining the class to use in the HTML debug output.

Definition at line 415 of file ezdebug.php.

References $debug, alwaysLogMessage(), dumpVariable(), instance(), isDebugEnabled(), and showMessage().

Referenced by eZExtension\activateExtensions(), and errorHandler().

## ◆ writeWarning()

static eZDebug::writeWarning | ( |  | $string,
|  |  | $label = `""`,
|  |  | $backgroundClass = `""`
| ) |  |
| static

Writes a debug warning.

The global variable `'eZDebugWarning'` will be set to `true` if the notice is added.

Parameters

  $label | This label will be associated with the notice, e.g. to say where the notice came from.

Definition at line 503 of file ezdebug.php.

References $debug, alwaysLogMessage(), dumpVariable(), instance(), isDebugEnabled(), and showMessage().

Referenced by eZFSFileHandler\_exclusiveLock(), accumulatorStop(), eZContentLanguage\addLanguage(), eZClusterFileHandler\cleanupGeneratingFiles(), errorHandler(), eZDFSFileHandler\fileDeleteByWildcard(), eZExtension\findExtensionType(), eZCodePage\load(), eZCodePageMapper\load(), eZTSTranslator\loadTranslationFile(), eZContentLanguage\prioritizedLanguages(), eZSession\regenerate(), eZFile\rename(), eZTranslationCache\restoreCache(), eZSiteAccess\saNameByLanguage(), eZTranslationCache\setContextCache(), eZTranslationCache\storeCache(), eZCodeMapper\warning(), and eZDebugSetting\writeWarning().

## Member Data Documentation

## ◆ $AlwaysLog

eZDebug::$AlwaysLog

Definition at line 2058 of file ezdebug.php.

## ◆ $bottomReportsList

eZDebug::$bottomReportsList

A list of debug reports that appears at the bottom of debug output.

Definition at line 2049 of file ezdebug.php.

## ◆ $DebugStrings

eZDebug::$DebugStrings = array()

String array containing the debug information

Definition at line 1994 of file ezdebug.php.

## ◆ $GlobalLogFileEnabled

eZDebug::$GlobalLogFileEnabled

Controls whether logfiles are used at all.

Definition at line 2036 of file ezdebug.php.

Referenced by isGlobalLogFileEnabled().

## ◆ $HandleType

eZDebug::$HandleType

Determines what to do with php errors, ignore, fetch or output.

Definition at line 2009 of file ezdebug.php.

## ◆ $LogFileEnabled

eZDebug::$LogFileEnabled

A map with message types and whether they should do file logging.

Definition at line 2033 of file ezdebug.php.

## ◆ $LogFiles

eZDebug::$LogFiles

An array of logfiles used by the debug class with each key being the debug level.

Definition at line 2015 of file ezdebug.php.

Referenced by logFiles().

## ◆ $MessageNames

eZDebug::$MessageNames

Definition at line 2056 of file ezdebug.php.

## ◆ $MessageOutput

eZDebug::$MessageOutput

Determines how messages are output (screen/log)

Definition at line 2027 of file ezdebug.php.

## ◆ $MessageTypes

eZDebug::$MessageTypes

A list of message types.

Definition at line 2030 of file ezdebug.php.

Referenced by messageTypes().

## ◆ $OldHandler

eZDebug::$OldHandler

Definition at line 2060 of file ezdebug.php.

## ◆ $OutputFormat

eZDebug::$OutputFormat

An array of the outputformats for the different debug levels.

Definition at line 2012 of file ezdebug.php.

## ◆ $OverrideList

eZDebug::$OverrideList

A list of override directories.

Definition at line 2046 of file ezdebug.php.

## ◆ $PercentAccuracy

eZDebug::$PercentAccuracy = 4

How many places behind . should be displayed when showing percentages.

Definition at line 2021 of file ezdebug.php.

## ◆ $recursionFlag

eZDebug::$recursionFlag = false
| private

Definition at line 2054 of file ezdebug.php.

## ◆ $ScriptStart

eZDebug::$ScriptStart

The time when the script was started.

Definition at line 2039 of file ezdebug.php.

Referenced by printReportInternal().

## ◆ $ScriptStop

eZDebug::$ScriptStop

The time when the script was stopped (of course this is an approximation, since the script must stop after printing debug info)

Definition at line 2043 of file ezdebug.php.

Referenced by printReportInternal().

## ◆ $ShowTypes

eZDebug::$ShowTypes

Determines which debug messages should be shown.

Definition at line 2006 of file ezdebug.php.

## ◆ $StoreLog

eZDebug::$StoreLog

Definition at line 59 of file ezdebug.php.

## ◆ $TimeAccumulatorGroupList

eZDebug::$TimeAccumulatorGroupList

Definition at line 2062 of file ezdebug.php.

Referenced by printReportInternal().

## ◆ $TimeAccumulatorList

eZDebug::$TimeAccumulatorList = array()

Array wich contains time accumulators.

Definition at line 2003 of file ezdebug.php.

Referenced by printReportInternal().

## ◆ $TimePoints

eZDebug::$TimePoints = array()

Array which contains the time points.

Definition at line 1997 of file ezdebug.php.

## ◆ $TimingAccuracy

eZDebug::$TimingAccuracy = 4

How many places behind . should be displayed when showing times.

Definition at line 2018 of file ezdebug.php.

## ◆ $TmpTimePoints

eZDebug::$TmpTimePoints

Array which contains the temporary time points.

Definition at line 2000 of file ezdebug.php.

## ◆ $topReportsList

eZDebug::$topReportsList

A list of debug reports that appears at the top of debug output.

Definition at line 2052 of file ezdebug.php.

## ◆ $UseCSS

eZDebug::$UseCSS

Whether to use external CSS or output own CSS. True if external is to be used.

Definition at line 2024 of file ezdebug.php.

## ◆ HANDLE_EXCEPTION

const eZDebug::HANDLE_EXCEPTION = 3

Definition at line 78 of file ezdebug.php.

Referenced by setHandleType().

## ◆ HANDLE_FROM_PHP

const eZDebug::HANDLE_FROM_PHP = 1

Definition at line 76 of file ezdebug.php.

Referenced by ezpbKernelAdmin\__construct(), ezpbKernelWeb\__construct(), ezpKernelTreeMenu\__construct(), ezpKernelWeb\__construct(), ezpKernelRest\__construct(), and setHandleType().

## ◆ HANDLE_NONE

const eZDebug::HANDLE_NONE = 0

Definition at line 75 of file ezdebug.php.

Referenced by __construct(), ezpKernelRest\__construct(), and setHandleType().

## ◆ HANDLE_TO_PHP

const eZDebug::HANDLE_TO_PHP = 2

Definition at line 77 of file ezdebug.php.

Referenced by setHandleType().

## ◆ LEVEL_DEBUG

const eZDebug::LEVEL_DEBUG = 5

Definition at line 64 of file ezdebug.php.

Referenced by eZUpdateDebugSettings(), ezpRestDebug\updateDebugSettings(), write(), and eZDebugSetting\writeDebug().

## ◆ LEVEL_ERROR

const eZDebug::LEVEL_ERROR = 3

Definition at line 62 of file ezdebug.php.

Referenced by eZUpdateDebugSettings(), ezpRestDebug\updateDebugSettings(), write(), and eZDebugSetting\writeError().

## ◆ LEVEL_NOTICE

const eZDebug::LEVEL_NOTICE = 1

Definition at line 60 of file ezdebug.php.

Referenced by eZUpdateDebugSettings(), ezpRestDebug\updateDebugSettings(), write(), and eZDebugSetting\writeNotice().

## ◆ LEVEL_STRICT

const eZDebug::LEVEL_STRICT = 6

Definition at line 65 of file ezdebug.php.

Referenced by eZUpdateDebugSettings(), ezpRestDebug\updateDebugSettings(), and write().

## ◆ LEVEL_TIMING_POINT

const eZDebug::LEVEL_TIMING_POINT = 4

Definition at line 63 of file ezdebug.php.

Referenced by eZDebugSetting\addTimingPoint(), and write().

## ◆ LEVEL_WARNING

const eZDebug::LEVEL_WARNING = 2

Definition at line 61 of file ezdebug.php.

Referenced by eZUpdateDebugSettings(), ezpRestDebug\updateDebugSettings(), write(), and eZDebugSetting\writeWarning().

## ◆ MAX_LOGFILE_SIZE

const eZDebug::MAX_LOGFILE_SIZE = 204800

Definition at line 83 of file ezdebug.php.

Referenced by maxLogSize().

## ◆ MAX_LOGROTATE_FILES

const eZDebug::MAX_LOGROTATE_FILES = 3

Definition at line 84 of file ezdebug.php.

Referenced by maxLogrotateFiles().

## ◆ OUTPUT_MESSAGE_SCREEN

const eZDebug::OUTPUT_MESSAGE_SCREEN = 1

Definition at line 80 of file ezdebug.php.

## ◆ OUTPUT_MESSAGE_STORE

const eZDebug::OUTPUT_MESSAGE_STORE = 2

Definition at line 81 of file ezdebug.php.

Referenced by __construct().

## ◆ SHOW_ALL

const eZDebug::SHOW_ALL = 63

Definition at line 73 of file ezdebug.php.

Referenced by __construct().

## ◆ SHOW_DEBUG

const eZDebug::SHOW_DEBUG = 16

Definition at line 71 of file ezdebug.php.

## ◆ SHOW_ERROR

const eZDebug::SHOW_ERROR = 4

Definition at line 69 of file ezdebug.php.

## ◆ SHOW_NOTICE

const eZDebug::SHOW_NOTICE = 1

Definition at line 67 of file ezdebug.php.

## ◆ SHOW_STRICT

const eZDebug::SHOW_STRICT = 32

Definition at line 72 of file ezdebug.php.

## ◆ SHOW_TIMING_POINT

const eZDebug::SHOW_TIMING_POINT = 8

Definition at line 70 of file ezdebug.php.

## ◆ SHOW_WARNING

const eZDebug::SHOW_WARNING = 2

Definition at line 68 of file ezdebug.php.

## ◆ XDEBUG_SIGNATURE

const eZDebug::XDEBUG_SIGNATURE = '--XDEBUG--'

Definition at line 86 of file ezdebug.php.

Referenced by dumpVariable().

The documentation for this class was generated from the following file:

- ezdebug.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.