-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Allow for a cleaner way to selectively shortcut loggings #373
Comments
It is actually doable with one hook: add_filter( 'simple_history/core_loggers', '__return_empty_array' );
add_action( 'simple_history/add_custom_logger', '...' ); I guess I was missing something after all 😄 |
Nice solution! Never though about that but I'm happy you found a way. |
@bonny seems that a PHP error is raised at
when using this solution:
The PHP Error[18-Jul-2023 11:33:48 UTC] PHP Notice: Undefined index: SimpleLogger in /wp-content/plugins/simple-history/inc/class-simple-history.php on line 2644 [18-Jul-2023 11:33:48 UTC] PHP Notice: Trying to access array offset on value of type null in /wp-content/plugins/simple-history/inc/class-simple-history.php on line 2644 [18-Jul-2023 11:33:48 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_event_ip_number_headers() on null in /wp-content/plugins/simple-history/inc/class-simple-history.php:2644 Stack trace: #0 /wp-content/plugins/simple-history/inc/class-simple-history.php(683): Simple_History\Simple_History->get_log_row_html_output(Object(stdClass), Array) #1 /wp-includes/class-wp-hook.php(308): Simple_History\Simple_History->api('') #2 /wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #3 /wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /wp-admin/admin-ajax.php(188): do_action('wp_ajax_simple_...') #5 {main in /wp-content/plugins/simple-history/inc/class-simple-history.php on line 2644 error is solved when allowing Simple_Logger to register:
The custom logger in this case is a very simple class that has one ![]() |
Ah, I never tried the plugin with no core loggers loaded at all. I will make a test and then a fix so I works in this scenario. |
@aanndryyyy This will hopefully be fixed in the next version. If you want to test already you can test with the main branch here. |
@aanndryyyy Please check if the latest version (4.4.0) of Simple History solved this. |
Background information: I am using Simple History as a logging framework where I want to disable all built-in logging functionality. I have also set the logging database to never purge (days = 0) and disabled the manual clearing button.
Currently the filters for
simple_history/log/do_log
are returning after eachapply_filters()
call. I propose to make it return only at the end, so instead of this:it would be possible to do this:
resulting in only MyCustomLogger logs being allowed. Or am I missing something and its already possible to do it like this? 🤔
Reference to hooks:
WordPress-Simple-History/loggers/class-logger.php
Lines 1065 to 1129 in cd40b93
The text was updated successfully, but these errors were encountered: