Skip to content

Instantly share code, notes, and snippets.

@erikreagan
Created June 18, 2011 13:48
Show Gist options
  • Save erikreagan/1033117 to your computer and use it in GitHub Desktop.
Save erikreagan/1033117 to your computer and use it in GitHub Desktop.

Revisions

  1. erikreagan revised this gist Jun 18, 2011. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions log_item.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    <?php>

    function log_item($str)
    {
    if ($this->debugging !== TRUE)
  2. erikreagan created this gist Jun 18, 2011.
    21 changes: 21 additions & 0 deletions log_item.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    function log_item($str)
    {
    if ($this->debugging !== TRUE)
    {
    return;
    }

    if ($this->depth > 0)
    {
    $str = str_repeat('&nbsp;', $this->depth * 5).$str;
    }

    $time = microtime(TRUE)-$this->start_microtime;
    $mem = '';
    if (function_exists('memory_get_usage'))
    {
    $mem = ' / '.number_format(round(memory_get_usage()/1024/1024, 2),2).'MB';
    }

    $this->log[] = '('.number_format($time, 6).$mem.') '.$str;
    }