trace = $trace_info; } $log_msg = print_r($log, true); } else { $log_msg = $log . ' in ' . $trace_info; } error_log($log_msg); } } public static function print($log, $path = '', $fileName = 'print.log', $fileOpenMode = 'a') { $rootDir = BITFORMS_CONTENT_DIR; $path = trim($path, '/'); $pathArr = explode('/', $path); // like "fieldname/user => [Fieldname, user] foreach ($pathArr as $d) { $rootDir .= $d . DIRECTORY_SEPARATOR; if (!realpath($rootDir)) { mkdir($rootDir); } } $fullPath = $rootDir . $fileName; $file = fopen($fullPath, $fileOpenMode); fwrite($file, $log); fclose($file); return true; } }