public static function write($str) { $dir = dirname(dirname(dirname(dirname(__FILE__)))); $dir = preg_replace("/(\\/)\$/", "", $dir); if (defined("MM_PLUGIN_ABSPATH")) { $dir = MM_PLUGIN_ABSPATH; } $l = new LogMe(); $output = $l->to_string($str); $file = $dir . "/logs/" . Date("Y-m-d") . ".log"; if (!file_exists($file)) { $fh = @fopen($file, "w"); if (!@fwrite($fh, $output . "\n\n")) { return false; } fclose($fh); } if (!is_writable($file)) { return false; } $a = "a"; $fs = filesize($file); //$size_ret = self::format_bytes($fs); // if(floatval($size_ret["result"])>MM_LOGSIZE) // { // $a="w"; // } $prefix = Date("m/d/Y h:i:s a") . " :\n"; $fh = @fopen($file, $a); if (!@fwrite($fh, $prefix . $output . "\n\n")) { return false; } fclose($fh); }
public static function write($anyObjOrStr) { $dir = BASE_DIR; $dir = preg_replace("/(\\/)\$/", "", $dir); $l = new LogMe(); $output = $l->to_string($anyObjOrStr); $file = $dir . "/log/" . Date("Y-m-d") . ".log"; if (!file_exists($file)) { $fh = @fopen($file, "w"); if (!@fwrite($fh, $output . "\n\n")) { return false; } fclose($fh); } if (!is_writable($file)) { return false; } $a = "a"; $fs = filesize($file); $prefix = Date("m/d/Y h:i:s a") . " :\n"; $fh = @fopen($file, $a); if (!@fwrite($fh, $prefix . $output . "\n\n")) { return false; } fclose($fh); }