1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 01:56:18 +02:00

Adjustments to the Memory processors

This commit is contained in:
Jordi Boggiano
2011-07-19 23:30:31 +02:00
parent 7788c0cee9
commit f9f27ce43f
3 changed files with 11 additions and 17 deletions

View File

@@ -13,11 +13,11 @@ namespace Monolog\Processor;
/**
* Some methods that are common for all memory processors
*
* @author Rob Jensen
*/
class MemoryProcessor
{
protected $realUsage;
/**
@@ -34,18 +34,17 @@ class MemoryProcessor
* @param int $bytes
* @return string
*/
public static function formatBytes($bytes)
protected static function formatBytes($bytes)
{
$bytes = (int) $bytes;
if ($bytes > 1024*1024) {
$bytes = round($bytes/1024/1024, 2).' MB';
return round($bytes/1024/1024, 2).' MB';
} elseif ($bytes > 1024) {
$bytes = round($bytes/1024, 2).' KB';
} else {
$bytes .= ' B';
return round($bytes/1024, 2).' KB';
}
return $bytes;
return $bytes . ' B';
}
}