Skip to content

Instantly share code, notes, and snippets.

@AoJ
Forked from Mikulas/gist:955777
Created May 9, 2011 17:51
Show Gist options
  • Save AoJ/962972 to your computer and use it in GitHub Desktop.
Save AoJ/962972 to your computer and use it in GitHub Desktop.
Logger
<?php
require "./Breto/libs/nette/loader.php";
class CustomDump
{
static public $file;
static function setFile($file) {
self::$file = $file;
}
static function log($a = NULL)
{
$file = fopen(self::$file, "a+");
foreach (func_get_args() as $arg) {
fwrite($file, Nette\Diagnostics\Debugger::dump($arg, TRUE));
}
fclose($file);
}
}
class Foo
{
public $prop = 'value';
function test($arg)
{
// hardcore ajax action
CustomDump::log($this, get_defined_vars());
}
}
CustomDump::setFile('log.txt');
$foo = new Foo;
$arg = 'a456sd';
$foo->test($arg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment