More efficient logging

This commit is contained in:
Netkas 2022-12-06 01:48:06 -05:00
parent 9507cd6e43
commit 274f33a5c9

View file

@ -32,7 +32,7 @@
*/
public static function set($key, $value): mixed
{
Console::outDebug(sprintf('setting cache entry \'%s\'', $key));
Console::outDebug($key);
self::$cache[$key] = $value;
return $value;
}
@ -45,7 +45,7 @@
*/
public static function get($key): mixed
{
Console::outDebug(sprintf('getting cache entry \'%s\'', $key));
Console::outDebug($key);
if(isset(self::$cache[$key]))
return self::$cache[$key];
@ -60,7 +60,7 @@
*/
public static function setFileAsTemporary(string $path): void
{
Console::outDebug(sprintf('setting file \'%s\' as temporary', $path));
Console::outDebug($path);
if(!in_array($path, self::$temporary_files))
self::$temporary_files[] = $path;
}
@ -74,7 +74,7 @@
*/
public static function removeFileAsTemporary(string $path): void
{
Console::outDebug(sprintf('removing file \'%s\' from temporary files list', $path));
Console::outDebug($path);
if(in_array($path, self::$temporary_files))
unset(self::$temporary_files[array_search($path, self::$temporary_files)]);
}
@ -88,7 +88,7 @@
{
if($clear_memory)
{
Console::outDebug('clearing memory cache');
Console::outDebug(sprintf('clearing memory cache (%d entries)', count(self::$cache)));
self::$cache = [];
}