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)) { wp_mkdir_p($rootDir); } } $fullPath = $rootDir . $fileName; if ('a' === $fileOpenMode) { FileHandler::appendFile($fullPath, $log); } else { FileHandler::writeFile($fullPath, $log); } return true; } }