Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.
Gravity PDF v4 will receive bug fixes and security updates until October 4, 2019, however it's recommended you upgrade to v5 as soon as practical.
Jump To Section

Description #description

Gravity PDF implements the PSR-3 logging library, Monolog, to handle all it’s logging requirements. When in production the logger doesn’t save any logs unless it’s enabled through Gravity Forms in-built logging setting, or when using the Gravity Forms Logging Add-on. Once you’ve enabled logging we’ll save the appropriate logs to disk for later review – errors and higher or notices and higher, depending on the log setting you selected.

When using the logging class all logs will automatically include the following details:

  • Function/method being called
  • Class called from (if applicable)
  • URL
  • Peak memory usage
  • File and line number called from
  • User IP
  • Timestamp

Version #version

This method was introduced in Gravity PDF 4.0.

Return #return

\Monolog\Logger | object
The logging class

Usage #usage

The following snippet shows you how to use this method and write to our log file:

add_action( 'init', function() {
    if ( class_exists( 'GPDFAPI' ) ) {
        /* Get Gravity PDF logging class */
        $logs = GPDFAPI::get_log_class();

        /* Write logs to file */
        $logs->addNotice( 'My plugin started operation X' );
        $logs->addWarning( 'Nonce Check Failed' );
        $logs->addError( 'Invalid ID number' );
        $logs->addCritical( 'Security issue: lack of User Capabilities' );
        $logs->addAlert( 'Plugin compatibility issue' );
        $logs->addEmergency( 'Plugin exploded' );

        /* You can also pass additional properties to the log by included a second argument as an array */
        $logs->addError( 'Invalid ID number', array(
            'form_id' => '5', /* This would usually be a variable */
        ) );
    }
} );

Source Code #source-code

This method is located in api.php.

Signup for the latest Gravity PDF news, tips and updates

  • This field is for validation purposes and should be left unchanged.
Scroll To Top

Choose your currency:

Close
Converted prices are for reference only - all orders are charged in $ Australian Dollars ($) AUD.
  • AUDAustralian Dollars ($)
  • USDUS Dollars ($)
  • CADCanadian Dollars ($)
  • EUREuros (€)
  • GBPPound Sterling (£)
  • NZDNew Zealand Dollar ($)
  • JPYJapanese Yen (¥)