Custom Logger not working as expected
-
I am currently hooking up a plugin to log events with Simple History, but there are several problems. I was following your tutorial on custom loggers and came up with this:
function crw_simple_history_logger ( $simpleHistory ) { class crw_logger extends SimpleLogger { public $slug = __CLASS__; function getInfo() { $arr_info = array( "name" => __( 'Crosswordsearch submissions', 'crosswordsearch' ), "description" => __('User submitted solutions for crosswordsearch riddles', 'crosswordsearch' ) ); return $arr_info; } function loaded() { // action hook to my plugin add_action( 'crw_solution_submitted', function ( $user, $submission ) { $text = crw_log_text( $user, $submission ); SimpleLogger()->info( implode( '<br/>', $text ), array( '_user_id' => $user->ID, '_initiator' => SimpleLoggerLogInitiators::WP_USER ) ); }, 10, 2 ); } } $simpleHistory->register_logger('crw_logger'); }; add_action("simple_history/add_custom_logger", 'crw_simple_history_logger' );'
Now,
- Why does the
logger
field still show up as “SimpleLogger”? - How do I get the logger to show up in the filter list?
- How can I log messages containing simple markup (
<strong>, <br />
)?
- Why does the
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom Logger not working as expected’ is closed to new replies.