'

MKP Base Use Custom Handler Function

You can use your own diagnostic message handler by creating a function that takes a message string as it’s sole argument. This is a bit tricky, so it’s a good idea to clear the diagnostics before resetting the option values and then show and clear it afterwards.

mkp_base clear_diagnostics
mkp_base verbose option=function set_option
mkp_base show_diagnostics clear_diagnostics

Output:


MKP Plugins: Setting Option verbose = [true]

MKP Plugins: Setting Option option = [function]


Diagnostic Logfile Contents

Logfile: /nas/content/live/mkpusaws/wp-content/MKP Plugins_29.log

08/23/19 20:01:26->MKP Plugins: Logfile [/nas/content/live/mkpusaws/wp-content/MKP Plugins_29.log] cleared
08/23/19 20:01:26->MKP Plugins: Getting name=[verbose] code=[verbose] value=[true]
08/23/19 20:01:26->MKP Plugins: Getting name=[option] code=[option] value=[function]
08/23/19 20:01:26->MKP Plugins: Getting name=[set_option] code=[set_option] value=[true]
08/23/19 20:01:26->MKP Plugins: Doing code=[verbose] name=[verbose] value=[true]
08/23/19 20:01:26->MKP Plugins: Doing code=[option] name=[option] value=[function]
08/23/19 20:01:26->MKP Plugins: Doing code=[set_option] name=[set_option] value=[true]
08/23/19 20:01:26->MKP Plugins: Setting Option verbose = [true]
08/23/19 20:01:26->MKP Plugins: Setting Option option = [function]
08/23/19 20:01:26->MKP Plugins: Old option = [a:14:{s:7:"enabled";b:1;s:7:"verbose";b:1;s:12:"do_backtrace";i:0;s:7:"logfile";s:15:"MKP Plugins.log";s:7:"handler";a:2:{s:5:"class";s:8:"MKP_Base";s:6:"method";s:11:"file_logger";}s:16:"show_all_igroups";b:0;s:21:"show_loggedin_igroups";b:0;s:6:"source";s:13:"MKP Plugins: ";s:8:"autoload";a:4:{s:11:"communities";b:0;s:8:"contacts";b:0;s:7:"igroups";b:0;s:6:"mapper";b:0;}s:17:"table_name_prefix";s:7:"mkpusa_";s:19:"options_name_prefix";s:10:"mkpusa_29_";s:19:"google_api_key_name";s:18:"mkp_google_api_key";s:20:"google_api_key_value";s:39:"AIzaSyCi8B3Z5SICnMBSYnhoNgZ3BaG8Lr_Of1k";s:6:"loaded";a:0:{}}]
08/23/19 20:01:26->MKP Plugins: New Option = [a:15:{s:7:"enabled";b:1;s:7:"verbose";b:1;s:12:"do_backtrace";i:0;s:7:"logfile";s:15:"MKP Plugins.log";s:7:"handler";a:2:{s:5:"class";s:8:"MKP_Base";s:6:"method";s:11:"file_logger";}s:16:"show_all_igroups";b:0;s:21:"show_loggedin_igroups";b:0;s:6:"source";s:13:"MKP Plugins: ";s:8:"autoload";a:4:{s:11:"communities";b:0;s:8:"contacts";b:0;s:7:"igroups";b:0;s:6:"mapper";b:0;}s:17:"table_name_prefix";s:7:"mkpusa_";s:19:"options_name_prefix";s:10:"mkpusa_29_";s:19:"google_api_key_name";s:18:"mkp_google_api_key";s:20:"google_api_key_value";s:39:"AIzaSyCi8B3Z5SICnMBSYnhoNgZ3BaG8Lr_Of1k";s:6:"loaded";a:0:{}s:6:"option";s:8:"function";}]
08/23/19 20:01:26->MKP Plugins: Getting name=[show_diagnostics] code=[show_diagnostics] value=[true]
08/23/19 20:01:26->MKP Plugins: Getting name=[clear_diagnostics] code=[clear_diagnostics] value=[true]
08/23/19 20:01:26->MKP Plugins: Doing code=[show_diagnostics] name=[show_diagnostics] value=[true]