AlkantarClanX12

Your IP : 216.73.217.24


Current Path : /www/capitalgmcbuickregina_830/public/wp-content/plugins/leadbox/
Upload File :
Current File : /www/capitalgmcbuickregina_830/public/wp-content/plugins/leadbox/test-logger.php

<?php
/**
 * Test script for LB_Logger
 *
 * Usage: Visit this URL in your browser:
 * http://lbx.local/wp-content/plugins/leadbox-plugin/test-logger.php
 *
 * Or run from command line:
 * php test-logger.php
 */

// Load WordPress
require_once(__DIR__ . '/../../../wp-load.php');

// Ensure logger is loaded
if (!function_exists('leadbox_logger')) {
    die('❌ ERROR: leadbox_logger() function not found. Make sure the plugin is activated.');
}

echo "🧪 Testing Leadbox Logger\n";
echo "========================\n\n";

// Test 1: DEBUG level
echo "1️⃣ Testing DEBUG log...\n";
leadbox_logger()->debug('This is a debug message', array(
    'test_number' => 1,
    'feature' => 'logger_test',
));
echo "   ✅ DEBUG log sent\n\n";

// Test 2: INFO level
echo "2️⃣ Testing INFO log...\n";
leadbox_logger()->info('User {user_id} performed {action}', array(
    'user_id' => get_current_user_id(),
    'action' => 'logger_test',
    'timestamp' => time(),
));
echo "   ✅ INFO log sent\n\n";

// Test 3: WARNING level
echo "3️⃣ Testing WARNING log...\n";
leadbox_logger()->warning('API response slow', array(
    'duration_ms' => 1500,
    'endpoint' => '/api/v1/test',
));
echo "   ✅ WARNING log sent\n\n";

// Test 4: ERROR level
echo "4️⃣ Testing ERROR log...\n";
leadbox_logger()->error('Test error for logging system', array(
    'error_code' => 'TEST_ERROR',
    'severity' => 'high',
    'component' => 'logger_test',
));
echo "   ✅ ERROR log sent\n\n";

// Test 5: CRITICAL level
echo "5️⃣ Testing CRITICAL log...\n";
leadbox_logger()->critical('Critical test error', array(
    'system' => 'test',
    'memory_usage' => memory_get_usage(true),
));
echo "   ✅ CRITICAL log sent\n\n";

// Check results
echo "📊 Results:\n";
echo "===========\n\n";

// Check if leadbox-debug.log was created
$debug_log = WP_CONTENT_DIR . '/leadbox-debug.log';
if (file_exists($debug_log)) {
    $log_size = filesize($debug_log);
    echo "✅ File logging: WORKING\n";
    echo "   Location: $debug_log\n";
    echo "   Size: " . number_format($log_size) . " bytes\n\n";

    // Show last 10 lines
    echo "📄 Last 10 lines of leadbox-debug.log:\n";
    echo "---------------------------------------\n";
    $lines = file($debug_log);
    $last_lines = array_slice($lines, -10);
    foreach ($last_lines as $line) {
        echo $line;
    }
    echo "\n";
} else {
    echo "⚠️  File logging: leadbox-debug.log not created yet\n";
    echo "   This is normal on first run. Try again.\n\n";
}

// Check database logging
global $wpdb;
$table_name = $wpdb->prefix . 'leadbox_logs';
$table_exists = $wpdb->get_var("SHOW TABLES LIKE '$table_name'") === $table_name;

if ($table_exists) {
    $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
    echo "✅ Database logging: WORKING\n";
    echo "   Table: $table_name\n";
    echo "   Total logs: $count\n\n";

    // Show last 5 logs
    $logs = $wpdb->get_results("SELECT * FROM $table_name ORDER BY timestamp DESC LIMIT 5", ARRAY_A);
    if ($logs) {
        echo "📊 Last 5 database logs:\n";
        echo "------------------------\n";
        foreach ($logs as $log) {
            echo sprintf(
                "[%s] %s: %s (Request: %s)\n",
                $log['timestamp'],
                $log['level'],
                $log['message'],
                $log['request_id']
            );
        }
        echo "\n";
    }
} else {
    echo "⚠️  Database logging: Table not created yet\n";
    echo "   This is normal. The table will be created on first ERROR log.\n\n";
}

// Configuration info
echo "⚙️  Configuration:\n";
echo "==================\n";
echo "WP_DEBUG: " . (WP_DEBUG ? 'true' : 'false') . "\n";
echo "WP_DEBUG_LOG: " . (defined('WP_DEBUG_LOG') && WP_DEBUG_LOG ? 'true' : 'false') . "\n";
echo "LEADBOX_LOG_LEVEL: " . (defined('LEADBOX_LOG_LEVEL') ? LEADBOX_LOG_LEVEL : 'ERROR (default)') . "\n";
echo "LEADBOX_LOG_TO_DATABASE: " . (defined('LEADBOX_LOG_TO_DATABASE') && LEADBOX_LOG_TO_DATABASE ? 'true' : 'false') . "\n\n";

echo "🎉 Test completed!\n\n";
echo "Next steps:\n";
echo "1. Check the file: wp-content/leadbox-debug.log (Leadbox logs only)\n";
echo "2. Check the file: wp-content/debug.log (WordPress critical errors only)\n";
echo "3. Visit WordPress Admin: Leadbox > Error Logs (if DB logging enabled)\n";
echo "4. Trigger a real error to test in production\n\n";

Home - Capital GMC Buick Regina

No data

Welcome to Capital GMC BUICK – REGINA

Thank you for choosing Capital GMC Buick | Regina, your premier certified Buick and GMC dealership proudly serving drivers in Regina and the surrounding communities. Whether you’re searching for a brand-new Buick or GMC vehicle or a meticulously inspected pre-owned model, we have a diverse selection to match your needs and lifestyle.

Beyond our impressive inventory, we offer a seamless and stress-free financing experience through our well-connected finance centre, where our team of experts is dedicated to securing the best loan or lease options for you, quickly, transparently, and hassle-free.

But our commitment to you doesn’t stop at the sale. Our state-of-the-art service centre is staffed with skilled Buick and GMC technicians who use the latest equipment and genuine OEM parts to keep your vehicle running at its best. From routine maintenance to complex repairs, we’ve got you covered.

Experience top-tier customer service, quality vehicles, and expert care, all in one place. Visit Capital GMC Buick | Regina today or call us at 306-205-8072 with any questions. We’re here to help!

Ask a Question