Skip to content

Commit

Permalink
Adds literal parameter for memory logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobemerick committed Jan 27, 2016
1 parent 4eb90d6 commit 08d7751
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Console.php
Expand Up @@ -38,14 +38,17 @@ public function log($data)
*
* @param mixed $object
* @param string $name
* @param boolean $literal
*/
public function logMemory($object = null, $name = 'PHP')
public function logMemory($object = null, $name = 'PHP', $literal = false)
{
$memory = memory_get_usage();
$dataType = '';
if (!is_null($object)) {
if (!is_null($object) && !$literal) {
$memory = strlen(serialize($object));
$dataType = gettype($object);
} else if (is_numeric($object) && $literal) {
$memory = floatval($object);
}

array_push($this->store, array(
Expand Down

0 comments on commit 08d7751

Please sign in to comment.