Skip to content

Commit f2fd1d0

Browse files
committed
Add a utility method for removing a debug log message
1 parent 4d36b34 commit f2fd1d0

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

php/class-utils.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,24 @@ public static function log( $message, $key = null ) {
781781
}
782782
}
783783

784+
/**
785+
* Remove a debug message.
786+
*
787+
* @param string $key The key that holds the message.
788+
*/
789+
public static function remove_log( $key ) {
790+
if ( ! get_plugin_instance()->get_component( 'report' )->enabled() || ! $key ) {
791+
return;
792+
}
793+
794+
$messages = get_option( Sync::META_KEYS['debug'], array() );
795+
796+
if ( isset( $messages[ $key ] ) ) {
797+
unset( $messages[ $key ] );
798+
update_option( Sync::META_KEYS['debug'], $messages, false );
799+
}
800+
}
801+
784802
/**
785803
* Get the debug messages.
786804
*

0 commit comments

Comments
 (0)