| @@ -21,9 +21,8 @@ | ||
| 21 | 21 | /** |
| 22 | 22 | * Constructor for the logger. |
| 23 | 23 | */ |
| 24 | 24 | protected function __construct() { |
| 25 | - | |
| 26 | 25 | } |
| 27 | 26 | |
| 28 | 27 | /** |
| 29 | 28 | * @var bool |
| @@ -30,9 +29,8 @@ | ||
| 30 | 29 | */ |
| 31 | 30 | protected static $_transaction_started = false; |
| 32 | 31 | |
| 33 | 32 | public function output() { |
| 34 | - | |
| 35 | 33 | } |
| 36 | 34 | |
| 37 | 35 | /** |
| 38 | 36 | * Set time start |
| @@ -126,16 +124,25 @@ | ||
| 126 | 124 | |
| 127 | 125 | /** |
| 128 | 126 | * Set error log |
| 129 | 127 | * |
| 130 | - * @param string $message | |
| 128 | + * @param Throwable $e | |
| 131 | 129 | * |
| 132 | 130 | * @return void |
| 131 | + * @version 1.0.1 | |
| 132 | + * @since 3.0.0 | |
| 133 | 133 | */ |
| 134 | - public static function error_log( string $message ) { | |
| 135 | - if ( LP_Debug::is_debug() ) { | |
| 136 | - error_log( $message ); | |
| 137 | - } | |
| 134 | + public static function error_log( Throwable $e ) { | |
| 135 | + error_log( sprintf( 'MESSAGE: %s FILE: %s LINE: %s', $e->getMessage(), $e->getFile(), $e->getLine() ) ); | |
| 136 | + } | |
| 137 | + | |
| 138 | + public static function log_to_comment( $comment_content ) { | |
| 139 | + wp_insert_comment( | |
| 140 | + [ | |
| 141 | + 'comment_content' => $comment_content, | |
| 142 | + 'comment_type' => 'lp_debug_log', | |
| 143 | + ] | |
| 144 | + ); | |
| 138 | 145 | } |
| 139 | 146 | |
| 140 | 147 | /** |
| 141 | 148 | * @return LP_Debug|null |