![]() |
Bearsampp 2026.5.5
|
Static Public Member Functions | |
| static | debug ($data, $file=null) |
| static | error ($data, $file=null) |
| static | flush () |
| static | getBufferSize () |
| static | getStats () |
| static | info ($data, $file=null) |
| static | init () |
| static | initClass ($classInstance) |
| static | reloadClass ($classInstance) |
| static | reset () |
| static | separator () |
| static | setBufferSize ($size) |
| static | trace ($data, $file=null) |
| static | warning ($data, $file=null) |
Data Fields | |
| const | DEBUG = 'DEBUG' |
| const | ERROR = 'ERROR' |
| const | INFO = 'INFO' |
| const | TRACE = 'TRACE' |
| const | WARNING = 'WARNING' |
Static Private Member Functions | |
| static | write ($data, $type, $file=null) |
Static Private Attributes | |
| static | $logBuffer = [] |
| static | $logBufferSize = 50 |
| static | $logStats |
| static | $shutdownRegistered = false |
Log class providing static logging methods with buffered I/O.
Supports five log levels (TRACE, DEBUG, INFO, WARNING, ERROR), a separator utility, class-lifecycle helpers, and a configurable write buffer to reduce file-system pressure.
Call Log\init() once during bootstrap (after globals are available) to register the shutdown flush handler.
Usage:
Definition at line 28 of file class.log.php.
|
static |
Logs a DEBUG-level message.
| mixed | $data | |
| string | null | $file |
Definition at line 287 of file class.log.php.
References write().
Referenced by ActionQuit\__construct(), Action\call(), Util\changePath(), BinApache\changePort(), BinMailpit\changePort(), BinMariadb\changePort(), BinMemcached\changePort(), BinMysql\changePort(), BinPostgresql\changePort(), BinXlight\changePort(), QuickPick\checkDownloadId(), ActionQuit\checkForOrphanedProcesses(), BinApache\checkPort(), BinMailpit\checkPort(), BinMariadb\checkPort(), BinMemcached\checkPort(), BinMysql\checkPort(), BinPostgresql\checkPort(), BinXlight\checkPort(), Csrf\cleanupExpiredTokens(), ActionQuit\cleanupTemporaryFiles(), Win32Native\countFilesFolders(), Win32Native\countFilesFoldersCOM(), Win32Native\createShortcut(), QuickPick\fetchAndUnzipModule(), Csrf\generateToken(), Util\getAppBinsRegKey(), Win32Native\getDefaultBrowser(), Util\getFilesToScan(), Util\getHeaders(), HttpClient\getHttpHeaders(), Win32Native\getInstalledBrowsers(), Util\getLatestVersion(), QuickPick\getModuleUrl(), Win32Native\getProcessList(), Win32Native\getServiceInfo(), Win32Native\getSpecialFolderPath(), QuickPick\getVersions(), BinPostgresql\handleNonPostgresUsage(), Win32Service\infos(), QuickPick\installModule(), Win32Native\killProcess(), Win32Native\listServices(), QuickPick\logHeaders(), ActionQuit\performQuickCleanupVerification(), Action\process(), ActionQuit\processWindow(), QuickPick\rebuildQuickpickJson(), BinApache\refreshAlias(), BinApache\refreshConf(), BinApache\refreshVhosts(), QuickPick\regenerateMenuSafe(), Win32Native\registryDeleteKey(), Win32Native\registryDeleteValue(), Win32Native\registryExists(), Win32Native\registryGetValue(), Win32Native\registrySetValue(), Symlinks\safeRemoveSymlink(), ActionStartup\scanFolders(), BinApache\setEnable(), BinMailpit\setEnable(), BinMariadb\setEnable(), BinMemcached\setEnable(), BinMysql\setEnable(), BinNodejs\setEnable(), BinPhp\setEnable(), BinPostgresql\setEnable(), BinXlight\setEnable(), Util\setFileScanCache(), Util\setFileScanCacheDuration(), Win32Service\start(), BinApache\switchVersion(), BinMailpit\switchVersion(), BinMariadb\switchVersion(), BinMemcached\switchVersion(), BinMysql\switchVersion(), BinNodejs\switchVersion(), BinPhp\switchVersion(), BinPostgresql\switchVersion(), BinXlight\switchVersion(), Core\unzipFile(), AppPhpmyadmin\updateConfig(), AppPhppgadmin\updateConfig(), BinApache\updateConfig(), BinMailpit\updateConfig(), BinMariadb\updateConfig(), BinMemcached\updateConfig(), BinMysql\updateConfig(), BinNodejs\updateConfig(), BinPhp\updateConfig(), BinPostgresql\updateConfig(), BinXlight\updateConfig(), Module\updateConfig(), ToolGit\updateConfig(), QuickPick\updateModuleConfig(), Csrf\validateToken(), ActionQuit\verifyServicesStoppedAndCleanup(), ActionStartup\writeLog(), Batch\writeLog(), CommandRunner\writeLog(), Nssm\writeLog(), Registry\writeLog(), Win32Service\writeLog(), and WinBinder\writeLog().
|
static |
Logs an ERROR-level message. Errors bypass the buffer and are written immediately.
| mixed | $data | |
| string | null | $file |
Definition at line 321 of file class.log.php.
References write().
Referenced by ActionLoading\__construct(), BinApache\changePort(), BinMailpit\changePort(), BinMariadb\changePort(), BinMemcached\changePort(), BinMysql\changePort(), BinPostgresql\changePort(), BinXlight\changePort(), QuickPick\checkDownloadId(), ActionQuit\checkForOrphanedProcesses(), BinApache\checkPort(), BinMailpit\checkPort(), BinMariadb\checkPort(), BinMemcached\checkPort(), BinMysql\checkPort(), BinPostgresql\checkPort(), BinXlight\checkPort(), ActionQuit\cleanupTemporaryFiles(), Win32Native\countFilesFolders(), Win32Native\countFilesFoldersCOM(), Win32Native\createShortcut(), Module\createSymlink(), Symlinks\deleteCurrentSymlinks(), QuickPick\fetchAndUnzipModule(), Win32Native\findProcessesByName(), UtilString\generateSecureBytes(), UtilString\generateSecureToken(), Csrf\generateToken(), HttpClient\get(), Core\getAppVersion(), Util\getCacheIntegrityKey(), HttpClient\getCurlHeaders(), HttpClient\getCurlHttpHeaders(), Core\getFileFromUrl(), Util\getLatestVersion(), QuickPick\getModuleUrl(), Win32Native\getProcessInfo(), Win32Native\getProcessList(), QuickPick\getQuickpickJson(), Win32Native\getServiceInfo(), Win32Native\getSpecialFolderPath(), QuickPick\getVersions(), Splash\init(), BinMariadb\initData(), QuickPick\installModule(), Util\installService(), Symlinks\isPathWithinAllowedBase(), Win32Native\killProcess(), Win32Native\listServices(), ActionCheckVersion\processWindow(), UtilString\random(), Win32Native\registryDeleteKey(), Win32Native\registryDeleteValue(), Win32Native\registryExists(), Win32Native\registrySetValue(), AppPhpmyadmin\reload(), AppPhppgadmin\reload(), BinApache\reload(), BinMailpit\reload(), BinMariadb\reload(), BinMemcached\reload(), BinMysql\reload(), BinNodejs\reload(), BinPhp\reload(), BinPostgresql\reload(), BinXlight\reload(), ToolBruno\reload(), ToolComposer\reload(), ToolGhostscript\reload(), ToolGit\reload(), ToolNgrok\reload(), ToolPerl\reload(), ToolPowerShell\reload(), ToolPython\reload(), ToolRuby\reload(), Util\removeService(), Symlinks\safeRemoveSymlink(), Win32Service\start(), Util\startService(), TplAppReload\triggerReload(), Core\unzipFile(), AppPhpmyadmin\updateConfig(), AppPhppgadmin\updateConfig(), BinApache\updateConfig(), BinMailpit\updateConfig(), BinMariadb\updateConfig(), BinMemcached\updateConfig(), BinMysql\updateConfig(), BinNodejs\updateConfig(), BinPhp\updateConfig(), BinPostgresql\updateConfig(), BinXlight\updateConfig(), QuickPick\updateModuleConfig(), ActionQuit\verifyServicesStoppedAndCleanup(), ActionQuit\verifySymlinksRemoved(), and Nssm\writeLogError().
|
static |
Flushes the log buffer to disk. Groups entries by file to minimise file operations. Falls back to error_log() if globals are unavailable or a write fails.
Definition at line 142 of file class.log.php.
References $bearsamppCore, and APP_TITLE.
Referenced by write().
|
static |
Returns the current log buffer size.
Definition at line 234 of file class.log.php.
|
static |
Returns the current log buffer statistics.
Definition at line 211 of file class.log.php.
|
static |
Logs an INFO-level message.
| mixed | $data | |
| string | null | $file |
Definition at line 298 of file class.log.php.
References write().
Referenced by ActionQuit\__construct(), ActionStartup\__construct(), ActionQuit\checkForOrphanedProcesses(), ActionQuit\cleanupTemporaryFiles(), Util\clearFileScanCache(), Batch\exitApp(), Util\getFilesToScan(), Util\installService(), ActionQuit\performQuickCleanupVerification(), ActionQuit\processWindow(), AppPhpmyadmin\reload(), AppPhppgadmin\reload(), Apps\reload(), BinApache\reload(), BinMailpit\reload(), BinMariadb\reload(), BinMemcached\reload(), BinMysql\reload(), BinNodejs\reload(), BinPhp\reload(), BinPostgresql\reload(), Bins\reload(), BinXlight\reload(), ToolBruno\reload(), ToolComposer\reload(), ToolGhostscript\reload(), ToolGit\reload(), ToolNgrok\reload(), ToolPerl\reload(), ToolPowerShell\reload(), ToolPython\reload(), ToolRuby\reload(), Util\removeService(), BinApache\setEnable(), BinMailpit\setEnable(), BinMariadb\setEnable(), BinMemcached\setEnable(), BinMysql\setEnable(), BinNodejs\setEnable(), BinPhp\setEnable(), BinPostgresql\setEnable(), BinXlight\setEnable(), Win32Service\start(), Apps\update(), Bins\update(), Tools\update(), QuickPick\updateModuleConfig(), ActionQuit\verifyServicesStoppedAndCleanup(), ActionQuit\verifySymlinksRemoved(), and Nssm\writeLogInfo().
|
static |
Registers the shutdown flush handler. Call once during bootstrap after globals are initialised.
Definition at line 58 of file class.log.php.
Referenced by Root\register(), and write().
|
static |
Logs the initialisation of a class instance at TRACE level.
| object | $classInstance |
Definition at line 331 of file class.log.php.
References trace().
Referenced by AppPhpmyadmin\__construct(), AppPhppgadmin\__construct(), BinApache\__construct(), BinMailpit\__construct(), BinMariadb\__construct(), BinMemcached\__construct(), BinMysql\__construct(), BinNodejs\__construct(), BinPhp\__construct(), BinPostgresql\__construct(), Bins\__construct(), BinXlight\__construct(), Homepage\__construct(), Nssm\__construct(), Registry\__construct(), Splash\__construct(), ToolBruno\__construct(), ToolComposer\__construct(), ToolGhostscript\__construct(), ToolGit\__construct(), ToolNgrok\__construct(), ToolPerl\__construct(), ToolPowerShell\__construct(), ToolPython\__construct(), ToolRuby\__construct(), Win32Service\__construct(), and WinBinder\__construct().
|
static |
Logs the reloading of a class instance at TRACE level.
| object | $classInstance |
Definition at line 341 of file class.log.php.
References trace().
Referenced by AppPhpmyadmin\reload(), AppPhppgadmin\reload(), BinApache\reload(), BinMailpit\reload(), BinMariadb\reload(), BinMemcached\reload(), BinMysql\reload(), BinNodejs\reload(), BinPhp\reload(), BinPostgresql\reload(), BinXlight\reload(), ToolBruno\reload(), ToolComposer\reload(), ToolGhostscript\reload(), ToolGit\reload(), ToolNgrok\reload(), ToolPerl\reload(), ToolPowerShell\reload(), ToolPython\reload(), and ToolRuby\reload().
|
static |
Clears the buffer and resets statistics. Useful in tests or when re-initialising the application.
Definition at line 195 of file class.log.php.
|
static |
Appends a separator line to each log file that does not already end with one.
@global object $bearsamppRoot
Definition at line 244 of file class.log.php.
References $bearsamppRoot.
Referenced by Root\register().
|
static |
Sets the log buffer size.
| int | $size | New buffer size (1–1000). |
Definition at line 222 of file class.log.php.
|
static |
Logs a TRACE-level message.
| mixed | $data | |
| string | null | $file |
Definition at line 276 of file class.log.php.
References write().
Referenced by ActionExec\__construct(), ActionLoading\__construct(), ActionManualRestart\__construct(), ActionRebuildini\__construct(), Win32Service\callWin32Service(), BinMysql\changeRootPassword(), ActionLoading\checkAllServicesStarted(), ActionStartup\checkApacheServiceWithTimeout(), ActionStartup\checkMySQLServiceWithTimeout(), BinMysql\checkPort(), BinMysql\checkRootPassword(), Win32Service\create(), OpenSsl\createCrt(), Win32Service\delete(), Win32Service\ensureReset(), Win32Service\fastServiceCheck(), Win32Service\infos(), initClass(), BinMariadb\initData(), BinMysql\initData(), ActionStartup\installServices(), ActionStartup\installServicesSequential(), Win32Service\isInstalled(), Win32Service\isPaused(), Win32Service\isPending(), Win32Service\isRunning(), Win32Service\isStopped(), ActionStartup\prepareService(), ActionLoading\processLoading(), ActionStartup\processWindow(), ActionSwitchVersion\processWindow(), BinMailpit\rebuildConf(), BinApache\refreshAlias(), BinApache\refreshConf(), BinApache\refreshVhosts(), reloadClass(), Config\replaceAll(), Util\replaceInFile(), ActionStartup\rotationLogs(), ActionStartup\scanFolders(), BinMailpit\setVersion(), BinPhp\setVersion(), Util\startLoading(), Win32Service\status(), Win32Service\stop(), ActionQuit\terminatePhpProcesses(), TplAppReload\triggerReload(), Core\unzipFile(), BinPhp\updateConfig(), ActionSwitchVersion\updateConfigVersion(), and Win32Service\waitForServiceDeletion().
|
static |
Logs a WARNING-level message.
| mixed | $data | |
| string | null | $file |
Definition at line 309 of file class.log.php.
References write().
Referenced by ActionQuit\checkForOrphanedProcesses(), ActionQuit\cleanupTemporaryFiles(), Util\getFileScanCache(), Batch\initializeMariadb(), Batch\initializeMysql(), Batch\initializePostgresql(), Util\installService(), ActionQuit\performQuickCleanupVerification(), ActionQuit\processWindow(), QuickPick\regenerateMenuSafe(), ToolGit\reload(), Util\removeService(), Symlinks\safeRemoveSymlink(), UtilInput\sanitizePath(), UtilInput\sanitizePID(), UtilInput\sanitizePort(), UtilInput\sanitizeServiceName(), Csrf\validateRequest(), Csrf\validateToken(), ActionQuit\verifyServicesStoppedAndCleanup(), and ActionQuit\verifySymlinksRemoved().
|
staticprivate |
Writes a message to a log file, using the buffer to reduce I/O.
The file path is resolved as follows:
| mixed | $data | The message to log. |
| string | $type | One of the Log level constants. |
| string | null | $file | Explicit file path, or null to use the default. |
Definition at line 78 of file class.log.php.
References $bearsamppConfig, $bearsamppCore, $bearsamppRoot, flush(), init(), Config\VERBOSE_DEBUG, Config\VERBOSE_REPORT, Config\VERBOSE_SIMPLE, and Config\VERBOSE_TRACE.
Referenced by debug(), error(), info(), trace(), and warning().
|
staticprivate |
Definition at line 37 of file class.log.php.
|
staticprivate |
Definition at line 40 of file class.log.php.
|
staticprivate |
Definition at line 46 of file class.log.php.
|
staticprivate |
Definition at line 43 of file class.log.php.
| const DEBUG = 'DEBUG' |
Definition at line 33 of file class.log.php.
| const ERROR = 'ERROR' |
Definition at line 30 of file class.log.php.
| const INFO = 'INFO' |
Definition at line 32 of file class.log.php.
| const TRACE = 'TRACE' |
Definition at line 34 of file class.log.php.
| const WARNING = 'WARNING' |
Definition at line 31 of file class.log.php.