5000) self::rename (); self::$count += fprintf (self::$fd, "%s: %s\n" ,strftime ('%Y-%m-%d %T') ,call_user_func_array ('sprintf', func_get_args ()) ); } static private function rename () { if (filesize (self::$file) > 1000000) { self::close (); $rename = self::$file.'.1'; if (file_exists ($rename)) unlink ($rename); rename (self::$file, $rename); self::$fd = fopen ($file, 'a'); } self::$count = 0; } }