Custom logger: Logging fails silently
-
Hey 🙂
I am currently working on a plugin, which among other things, should log its behaviour using your excellent plugin.
I am basing my plugin on the WordPress Plugin Boilerplate found here:
https://github.com/devinvinson/WordPress-Plugin-Boilerplate/My plugin code is here: https://github.com/HansCz/tr-project-status-updater
I load the plugin via the
'simple_history/add_custom_logger'hook in line 158, found in the fileincludes/class-tr-project-status-updater.php.
This refers toload_loggers()inadmin/class-tr-project-status-updater-admin.php, which looks like this:public function load_loggers($simpleHistory) { require plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-tr-project-status-updater-logger.php'; $simpleHistory->register_logger("Tr_Project_Status_Updater_Logger_Settings"); }In
includes/class-tr-project-status-updater-logger.phpthings fail silently around line 86:$this->infoMessage("setting_updated", $context);Everything looks normal, however. Labels are in place in the search filter, etc.
If I refer to SimpleLogger directly like so:
SimpleLogger()->info($this->getInfo()["messages"]["setting_updated"], $context);the message logs fine.
I would very much like to be able to filter the SimpleLogger dashboard widget to show only these messages. So from what I understand,
SimpleLogger()->info(...)won’t do. I’ll have to use$this->infoMessage(...).It seems to fail silently somehow. Maybe you can take a look and tell me where it goes wrong?
Thank you.
– Hans
The topic ‘Custom logger: Logging fails silently’ is closed to new replies.