activities_helper.php
3 months ago
agent_helper.php
3 months ago
analytics_helper.php
1 week ago
auth_helper.php
2 months ago
blocks_helper.php
2 weeks ago
booking_helper.php
1 week ago
bricks_helper.php
3 months ago
bundles_helper.php
3 months ago
calendar_helper.php
2 weeks ago
carts_helper.php
3 months ago
connector_helper.php
3 months ago
csv_helper.php
3 months ago
customer_helper.php
1 month ago
customer_import_helper.php
1 month ago
database_helper.php
1 week ago
debug_helper.php
3 months ago
defaults_helper.php
3 months ago
elementor_helper.php
3 months ago
email_helper.php
3 months ago
encrypt_helper.php
3 months ago
events_helper.php
3 months ago
form_helper.php
3 months ago
icalendar_helper.php
3 months ago
image_helper.php
3 months ago
invoices_helper.php
2 weeks ago
license_helper.php
3 months ago
location_helper.php
3 months ago
marketing_systems_helper.php
3 months ago
meeting_systems_helper.php
3 months ago
menu_helper.php
2 weeks ago
meta_helper.php
3 months ago
migrations_helper.php
3 months ago
money_helper.php
3 months ago
notifications_helper.php
3 months ago
nps_survey_helper.php
3 months ago
order_intent_helper.php
1 month ago
orders_helper.php
3 months ago
otp_helper.php
3 months ago
pages_helper.php
3 months ago
params_helper.php
3 months ago
payments_helper.php
2 months ago
plugin_version_update_helper.php
2 months ago
price_breakdown_helper.php
3 months ago
process_jobs_helper.php
3 months ago
processes_helper.php
3 months ago
razorpay_connect_helper.php
1 week ago
replacer_helper.php
3 months ago
resource_helper.php
3 months ago
roles_helper.php
2 weeks ago
router_helper.php
3 months ago
service_helper.php
3 months ago
sessions_helper.php
3 months ago
settings_helper.php
1 week ago
short_links_systems_helper.php
3 months ago
shortcodes_helper.php
2 weeks ago
sms_helper.php
3 months ago
steps_helper.php
1 week ago
stripe_connect_helper.php
1 week ago
styles_helper.php
3 months ago
support_topics_helper.php
3 months ago
time_helper.php
2 months ago
timeline_helper.php
2 months ago
transaction_helper.php
1 month ago
transaction_intent_helper.php
3 months ago
util_helper.php
1 month ago
version_specific_updates_helper.php
3 months ago
whatsapp_helper.php
1 month ago
work_periods_helper.php
3 months ago
wp_datetime.php
3 months ago
wp_user_helper.php
3 months ago
debug_helper.php
94 lines
| 1 | <?php |
| 2 | |
| 3 | class OsDebugHelper { |
| 4 | public static function log_braintree_exception( $e ) { |
| 5 | $body = $e->getJsonBody(); |
| 6 | $err = $body['error']; |
| 7 | $return_array = [ |
| 8 | 'status' => $e->getHttpStatus(), |
| 9 | 'type' => $err['type'], |
| 10 | 'code' => $err['code'], |
| 11 | 'param' => $err['param'], |
| 12 | 'message' => $err['message'], |
| 13 | ]; |
| 14 | $error_msg = wp_json_encode( $return_array ); |
| 15 | error_log( $error_msg ); |
| 16 | } |
| 17 | |
| 18 | public static function log_stripe_exception( $e ) { |
| 19 | $body = $e->getJsonBody(); |
| 20 | $err = $body['error']; |
| 21 | $return_array = [ |
| 22 | 'status' => $e->getHttpStatus(), |
| 23 | 'type' => $err['type'], |
| 24 | 'code' => $err['code'], |
| 25 | 'param' => $err['param'], |
| 26 | 'message' => $err['message'], |
| 27 | ]; |
| 28 | $error_msg = wp_json_encode( $return_array ); |
| 29 | error_log( $error_msg ); |
| 30 | } |
| 31 | |
| 32 | public static function log_files( $files ) { |
| 33 | if ( ! OsSettingsHelper::is_env_dev() ) { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | if ( is_array( $files ) || is_object( $files ) ) { |
| 38 | error_log( 'LatePoint Files: ' . print_r( $files, true ) ); |
| 39 | } else { |
| 40 | error_log( 'LatePoint Files: ' . $files ); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | public static function log_route( $route_name, $return_format ) { |
| 45 | if ( ! OsSettingsHelper::is_env_dev() ) { |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | error_log( 'LatePoint ROUTE: [' . $route_name . ']:' . $return_format ); |
| 50 | } |
| 51 | |
| 52 | public static function log_params( $params ) { |
| 53 | if ( ! OsSettingsHelper::is_env_dev() ) { |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | if ( is_array( $params ) || is_object( $params ) ) { |
| 58 | error_log( 'LatePoint Params: ' . print_r( $params, true ) ); |
| 59 | } else { |
| 60 | error_log( 'LatePoint Params: ' . $params ); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | public static function log_query( $query ) { |
| 65 | if ( ! OsSettingsHelper::is_env_dev() || defined( 'LATEPOINT_SKIP_SQL_LOG' ) ) { |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | if ( is_array( $query ) || is_object( $query ) ) { |
| 70 | error_log( 'LatePoint Query: ' . print_r( $query, true ) ); |
| 71 | } else { |
| 72 | error_log( 'LatePoint Query: ' . $query ); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | public static function log( $message, $error_code = 'generic_error', $extra_description = [] ) { |
| 77 | if ( is_array( $message ) || is_object( $message ) ) { |
| 78 | $message = print_r( $message, true ); |
| 79 | } |
| 80 | OsActivitiesHelper::create_activity( |
| 81 | [ |
| 82 | 'code' => 'error', |
| 83 | 'description' => wp_json_encode( |
| 84 | [ |
| 85 | 'message' => $message, |
| 86 | 'error_code' => $error_code, |
| 87 | 'extra_description' => $extra_description, |
| 88 | ] |
| 89 | ), |
| 90 | ] |
| 91 | ); |
| 92 | } |
| 93 | } |
| 94 |