WordPressMVC

  1. Get Started
  2. Documentation
  3. Tutorials
  4. Blog
  1. Documentation
  2. Tutorials
v1.0.8 Login
  • Blog
  • Download
  • Get Started
  • The Basics
    • Ayuco
    • Main Class
    • Configuration
  • Hooks
    • Actions
    • Filters
    • Widgets
    • Shortcodes
  • MVC
    • Models
    • Post Models
    • Option Models
    • Term Models
    • User Models
    • Views
    • Controllers
  • Resources
    • Assets
    • Styles
    • Scripts
  • Advanced
    • Request
    • Response
    • Localization
    • Cache
    • Logger
    • Database
    • Testing
    • Deployment
    • Functions
    • Add-ons

Logger

Last updated: January 12, 2020

The Logger enables the functionality of logging messages, errors and debugging values in log files. The logger is a modified version of KLogger.

Storage path

Log files are stored at {wp-content}/wpmvc/log folder.

Usage

Before start using the Logger, add the use statement at the beginning of your PHP file to call it.

use WPMVC\Log;

Info

Use the static method info() to log a message.

Log::info( 'My string message' );

Debug

Use the static method debug() to log a variable and its value. This enables code debugging without having to break HTML design.

/**
 * @param string String identifier of the value to debug.
 * @param mixed  Supported data types as value parameters are:
 *               string, numeric and array.
 */
Log::debug( 'Value', $value );

Error

Use the static method error() to log execution errors and exceptions.

// Logs errors and exception.
Log::error( $exception );

// Usage in a try/catch statement.
try {
    // { Any code here... }
} catch ( Exception $e ) {
    
    Log::error( $e );
    
}
© 2023 10 Quality Studio . All rights reserved.
Search in: