Wednesday, April 22, 2009

Survive in php.. a logger method.


function logger($msg){
if(!isset($GLOBALS['logger'])){
$GLOBALS['logger'] = fopen("/var/www/apps/logs/dev.log","a");
}
fwrite($GLOBALS['logger'],"$msg\n");
}

function request($id = ''){
logger("dir/file.php::request(id[".$id."])");
...
}

No comments: