PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
← All changes | includes/Core/Util/Log.php +26 -5 2.03.3.1 View file →
@@ -1,10 +1,12 @@
1 1 <?php
2 2
3 3 namespace BitCode\BitForm\Core\Util;
4 4
5 -final class Log {
6 - public static function get_backtrace_info() {
5 +final class Log
6 +{
7 + public static function get_backtrace_info()
8 + {
7 9 $trace = debug_backtrace();
8 10
9 11 $file = $trace[1]['file'];
10 12 $class = $trace[2]['class'];
@@ -23,9 +25,10 @@
23 25
24 26 return $output;
25 27 }
26 28
27 - public static function debug_log($log) {
29 + public static function debug_log($log)
30 + {
28 31 $trace_info = self::get_backtrace_info();
29 32 if (WP_DEBUG === true) {
30 33 if (is_array($log) || is_object($log)) {
31 34 if (is_array($log)) {
@@ -38,9 +41,27 @@
38 41 $log_msg = $log . ' in ' . $trace_info;
39 42 }
40 43
41 44 error_log($log_msg);
42 - // var_dump($log_msg);
43 45 }
44 - // die;
46 + }
47 +
48 + public static function print($log, $path = '', $fileName = 'print.log', $fileOpenMode = 'a')
49 + {
50 + $rootDir = BITFORMS_CONTENT_DIR;
51 + $path = trim($path, '/');
52 + $pathArr = explode('/', $path); // like "fieldname/user => [Fieldname, user]
53 + foreach ($pathArr as $d) {
54 + $rootDir .= $d . DIRECTORY_SEPARATOR;
55 + if (!realpath($rootDir)) {
56 + wp_mkdir_p($rootDir);
57 + }
58 + }
59 + $fullPath = $rootDir . $fileName;
60 + if ('a' === $fileOpenMode) {
61 + FileHandler::appendFile($fullPath, $log);
62 + } else {
63 + FileHandler::writeFile($fullPath, $log);
64 + }
65 + return true;
45 66 }
46 67 }