| @@ -39,14 +39,9 @@ | ||
| 39 | 39 | // Format log entry |
| 40 | 40 | $timestamp = current_time('Y-m-d H:i:s'); |
| 41 | 41 | $context_str = !empty($context) ? ' | Context: ' . wp_json_encode($context) : ''; |
| 42 | 42 | $log_entry = sprintf('[%s] [%s] %s%s', $timestamp, strtoupper($level), $message, $context_str); |
| 43 | - | |
| 44 | - // Write to WordPress debug log if WP_DEBUG_LOG is enabled | |
| 45 | - if (defined('WP_DEBUG_LOG') && WP_DEBUG_LOG) { | |
| 46 | - error_log('Yatra: ' . $log_entry); | |
| 47 | - } | |
| 48 | - | |
| 43 | + | |
| 49 | 44 | // Store in database for admin viewing |
| 50 | 45 | self::storeLog($message, $level, $context); |
| 51 | 46 | } |
| 52 | 47 | |
| @@ -100,9 +95,9 @@ | ||
| 100 | 95 | if (count($logs) > 1000) { |
| 101 | 96 | $logs = array_slice($logs, -1000); |
| 102 | 97 | } |
| 103 | 98 | |
| 104 | - update_option('yatra_logs', $logs); | |
| 99 | + update_option('yatra_logs', $logs, false); // autoload=false: grows; read on demand only | |
| 105 | 100 | } |
| 106 | 101 | |
| 107 | 102 | /** |
| 108 | 103 | * Get logs |