/** * Log something using wp_mail() and error_log(), include useful WordPress info. * * Note: This method is here temporarily. We are using it to find & fix bugs for the first iterations of import. * Do not count on this method being here in the future. * * @deprecated * * @param string $message * @param array $more_info */ static function log($message, array $more_info = array()) { /** $var \WP_User $current_user */ global $current_user; $subject = '[ Import Log ]'; $info = array('time' => strftime('%c'), 'user' => isset($current_user) ? $current_user->user_login : '******', 'site_url' => site_url(), 'blog_id' => get_current_blog_id()); $message = print_r(array_merge($info, $more_info), true) . $message; \Pressbooks\Utility\email_error_log(self::$logsEmail, $subject, $message); }
/** * Log Exceptions * * @param \Exception $e */ protected function logException(\Exception $e) { $subject = __('SASS Error'); /** $var \WP_User $current_user */ global $current_user; $info = array('time' => strftime('%c'), 'user' => isset($current_user) ? $current_user->user_login : '******', 'site_url' => site_url(), 'blog_id' => get_current_blog_id(), 'Exception' => array('code' => $e->getCode(), 'error' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString())); $message = print_r(array_merge($info), true); \Pressbooks\Utility\email_error_log($this->errorsEmail, $subject, $message); }
/** * Log errors using wp_mail() and error_log(), include useful WordPress info. * * @param string $message * @param array $more_info */ function logError($message, array $more_info = array()) { /** $var \WP_User $current_user */ global $current_user; $subject = get_class($this); $info = array('time' => strftime('%c'), 'user' => isset($current_user) ? $current_user->user_login : '******', 'site_url' => site_url(), 'blog_id' => get_current_blog_id(), 'theme' => '' . wp_get_theme()); $message = print_r(array_merge($info, $more_info), true) . $message; $exportoptions = get_option('pressbooks_export_options'); if (@$current_user->user_email && isset($exportoptions['email_validation_logs']) && 1 == $exportoptions['email_validation_logs']) { $this->errorsEmail[] = $current_user->user_email; } \Pressbooks\Utility\email_error_log($this->errorsEmail, $subject, $message); }