Skip to main content

GFLogging

Gravity Forms Logging.

Since: 2.2

Source: includes/logging/logging.php:17

Details

  • Kind: class
  • Namespace: (global)
  • Extends: GFAddOn

Properties

PropertyTypeDescription
$_slugstringThe slug used for this plugin.
$_pathstringThe path to the main plugin file, relative to the plugins folder.
$_full_pathstringThe full path.
$_titlestringThe title of the Add-On.
$_short_titlestringThe short title.
$_capabilities_settings_pagestringThe capability needed to access the Add-On settings page.
$_capabilities_form_settingsstringThe capability needed to access the Add-On form settings page.
$_capabilitiesarrayThe capabilities needed for the Add-On
$_nonce_actionstringNonce action for deleting logs from the logging page.

Methods

MethodDescription
get_instance()Get instance of this class.
init()Register needed hooks and included needed libraries.
plugin_settings_page()Maybe delete log files.
plugin_settings_fields()Setup plugin settings fields.
plugin_settings_description()Setup plugin settings description.
plugin_settings_title()Setup plugin settings title.
plugin_settings_link()Prevent Settings link from being added to plugin action links if Logging Add-On is available.
get_menu_icon()Return the plugin's icon for the plugin/form settings menu.
render_uninstall()Prevent uninstall section from appearing.
prepare_settings_checkbox_and_select()Prepares a checkbox and select field based on the $field array
supported_plugins_fields()Prepare supported plugins as plugin settings fields.
get_logging_choices()Get available logging levels as choices.
log_message()Log message.
is_enabled()Determines if logging is enabled for a plugin.
delete_log_file()Delete log file for plugin.
delete_log_files()Delete all log files and log file directory.
get_log_dir()Get path to log file directory.
get_log_dir_url()Get url to log file directory.
get_log_file_name()Get file name for plugin log file.
get_log_file_url()Get file url for plugin log file.
log_file_exists()Check if log file exists for plugin.
get_log_file_size()Get log file size by plugin slug or file path.
include_logger()Include KLogger library.
flush_loggers()Flushes the cached KLogger objects.
disable_logging()Disable all logging.
upgrade()Run necessary upgrade routines.
upgrade_from_pre_ui_update()Update plugin settings to use new structure introduced in 1.3.
upgrade_from_pre_addon_framework()Upgrade plugin from pre Add-On Framework version.
set_logging_supported()Logging itself does not support logging.
get_supported_plugins()Get list of plugins that support Logging.
load_text_domain()Initializing translations using the gravityforms domain.

Method Reference

get_instance()

public static function get_instance()

Get instance of this class.

Returns

Since: 2.2

Source: includes/logging/logging.php:155

init()

public function init()

Register needed hooks and included needed libraries.

Since:

  • 2.2
  • 2.4.18 (Removed caps integrations to prevent them being added to the Add-Ons group.)

Source: includes/logging/logging.php:173

plugin_settings_page()

public function plugin_settings_page()

Maybe delete log files.

Since: 2.2

Source: includes/logging/logging.php:194

plugin_settings_fields()

public function plugin_settings_fields()

Setup plugin settings fields.

Returns

  • array

Since: 2.2

Source: includes/logging/logging.php:253

plugin_settings_description()

public function plugin_settings_description()

Setup plugin settings description.

Returns

  • string — $html

Since: 2.2

Source: includes/logging/logging.php:289

plugin_settings_title()

public function plugin_settings_title()

Setup plugin settings title.

Returns

  • string

Since: 2.2

Source: includes/logging/logging.php:307

public function plugin_settings_link( $links, $file )

Prevent Settings link from being added to plugin action links if Logging Add-On is available.

Parameters

NameTypeDefaultDescription
$linksarrayAn array of plugin action links.
$filestringPath to the plugin file.

Returns

  • array

Since: 2.2

Source: includes/logging/logging.php:324

get_menu_icon()

public function get_menu_icon()

Return the plugin's icon for the plugin/form settings menu.

Returns

  • string

Since: 2.5

Source: includes/logging/logging.php:337

render_uninstall()

public function render_uninstall()

Prevent uninstall section from appearing.

Since: 2.2

Source: includes/logging/logging.php:349

prepare_settings_checkbox_and_select()

public function prepare_settings_checkbox_and_select( $field )

Prepares a checkbox and select field based on the $field array

Parameters

NameTypeDefaultDescription
$fieldarrayField array containing the configuration options of this field.

Returns

  • array — $field

Since: 1.2

Source: includes/logging/logging.php:359

supported_plugins_fields()

public function supported_plugins_fields()

Prepare supported plugins as plugin settings fields.

Returns

  • array — $fields

Since: 2.2

Source: includes/logging/logging.php:423

get_logging_choices()

public function get_logging_choices()

Get available logging levels as choices.

Returns

  • array

Since: 2.5

Source: includes/logging/logging.php:506

log_message()

public static function log_message( $plugin, $message=null, $message_type=KLogger::DEBUG )

Log message.

Parameters

NameTypeDefaultDescription
$pluginstringPlugin name.
$messagestringnull(default: null) Message to log.
$message_typeintKLogger::DEBUG(default: KLogger::DEBUG) Message type. NOTE: This function is static for backwards compatibility reasons. Some legacy add-ons still reference this function statically

Source: includes/logging/logging.php:549

is_enabled()

public static function is_enabled( $plugin='gravityforms' )

Determines if logging is enabled for a plugin.

Parameters

NameTypeDefaultDescription
$pluginstring'gravityforms'The plugin slug.

Returns

  • bool

Since: 2.9.26

Source: includes/logging/logging.php:614

delete_log_file()

public function delete_log_file( $plugin_name )

Delete log file for plugin.

Parameters

NameTypeDefaultDescription
$plugin_namestringPlugin name.

Returns

  • bool — If file was successfully deleted

Since: 2.2

Source: includes/logging/logging.php:642

delete_log_files()

public function delete_log_files()

Delete all log files and log file directory.

Since: 2.2

Source: includes/logging/logging.php:659

get_log_dir()

public function get_log_dir()

Get path to log file directory.

Returns

  • string

Since: 2.2

Source: includes/logging/logging.php:684

get_log_dir_url()

public function get_log_dir_url()

Get url to log file directory.

Returns

  • string

Since: 2.2

Source: includes/logging/logging.php:699

get_log_file_name()

public function get_log_file_name( $plugin_name )

Get file name for plugin log file.

Parameters

NameTypeDefaultDescription
$plugin_namestringPlugin name.

Returns

  • string — File path to log file.

Since: 2.2

Source: includes/logging/logging.php:715

get_log_file_url()

public function get_log_file_url( $plugin_name )

Get file url for plugin log file.

Parameters

NameTypeDefaultDescription
$plugin_namestringPlugin name.

Returns

  • string — URL to log file.

Since: 2.2

Source: includes/logging/logging.php:744

log_file_exists()

public function log_file_exists( $plugin_name )

Check if log file exists for plugin.

Parameters

NameTypeDefaultDescription
$plugin_namestringPlugin slug.

Returns

  • bool

Since: 2.2

Source: includes/logging/logging.php:760

get_log_file_size()

public function get_log_file_size( $plugin_name_or_path, $is_path=false )

Get log file size by plugin slug or file path.

Parameters

NameTypeDefaultDescription
$plugin_name_or_pathstringThe plugin slug or log file path.
$is_pathboolfalseIndicates if the file path is being provided instead of the plugin slug.

Returns

  • string — File size with unit of measurement.

Since:

  • 1.2.1
  • 2.8.3 (Updated params.)

Source: includes/logging/logging.php:779

include_logger()

public static function include_logger()

Include KLogger library.

Since: 2.2

Source: includes/logging/logging.php:815

flush_loggers()

public function flush_loggers()

Flushes the cached KLogger objects.

Since: 2.4.15

Source: includes/logging/logging.php:872

disable_logging()

public function disable_logging()

Disable all logging.

Since: 2.2

Source: includes/logging/logging.php:883

upgrade()

public function upgrade( $previous_version )

Run necessary upgrade routines.

Parameters

NameTypeDefaultDescription
$previous_versionstringThe version of the Logging Add-On we're upgrading from.

Since: 2.2

Source: includes/logging/logging.php:955

upgrade_from_pre_ui_update()

public function upgrade_from_pre_ui_update()

Update plugin settings to use new structure introduced in 1.3.

Since: 1.3

Source: includes/logging/logging.php:995

upgrade_from_pre_addon_framework()

public function upgrade_from_pre_addon_framework()

Upgrade plugin from pre Add-On Framework version.

Since: 2.1.1.2

Source: includes/logging/logging.php:1026

set_logging_supported()

public function set_logging_supported( $plugins )

Logging itself does not support logging.

Parameters

NameTypeDefaultDescription
$pluginsarrayThe plugins which support logging.

Returns

  • array

Since: 2.2

Source: includes/logging/logging.php:1104

get_supported_plugins()

public function get_supported_plugins()

Get list of plugins that support Logging.

Returns

  • array — $supported_plugins

Since: 2.2

Source: includes/logging/logging.php:1118

load_text_domain()

public function load_text_domain()

Initializing translations using the gravityforms domain.

Since: 2.2

Source: includes/logging/logging.php:1144