Skip to content

Commit d430ff6

Browse files
Clear logs when turned on
1 parent 6cfae11 commit d430ff6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/class-tiny-logger.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,13 @@ public function get_log_file_path() {
103103
/**
104104
* Triggered when log_enabled is saved
105105
* - set the setting on the instance
106-
* - if turn off, clear the logs
107-
* - if turned on, check if we can create the log file
106+
* - if turn on, clear the old logs
108107
*/
109108
public static function on_save_log_enabled( $log_enabled, $old, $option ) {
110109
$instance = self::get_instance();
111110
$instance->log_enabled = 'on' === $log_enabled;
112111

113-
if ( 'on' !== $log_enabled ) {
112+
if ( $instance->get_log_enabled() ) {
114113
$instance->clear_logs();
115114
}
116115

0 commit comments

Comments
 (0)