Skip to content

Commit

Permalink
Add command line only --clearOn filter that will clear the log if sai…
Browse files Browse the repository at this point in the history
…d text appears in it
  • Loading branch information
mitchcapper committed Aug 11, 2024
1 parent e2e2e43 commit 63723a0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/LogCatch.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exec wish "$0" -- "$@"
set runDir [pwd]
set procRegex ""
set autoOpenDevice ""
set autoClearLogOn ""
set showConsole 0

for { set i 0 } { $i < [llength $argv] } { incr i } {
Expand All @@ -28,6 +29,9 @@ foreach {opt val} $argv {
if {"$opt" == "--device"} {
set autoOpenDevice $val
}
if {"$opt" == "--clearOn"} {
set autoClearLogOn $val
}
}
if { $showConsole } {
console show
Expand Down Expand Up @@ -292,7 +296,7 @@ proc loadBuffer {fd} {
}

proc readLine {fd} {
global logview LineCount statusOne LogLevels Loading SuspendReading
global logview LineCount statusOne LogLevels Loading SuspendReading autoClearLogOn

if {$Loading == -1} {
puts "Stop Loading"
Expand All @@ -305,6 +309,12 @@ proc readLine {fd} {
return $cnt
}
if {$cnt >= 0} {
if {"$autoClearLogOn" != ""} {
if {[string first $autoClearLogOn $line] != -1} {
puts "AutoClearLog str match clearing log "
clearLogView
}
}
set loglevel [getLogLevel "$line"]
if {[lsearch $LogLevels "$loglevel"] == -1} {
set loglevel "V"
Expand Down

0 comments on commit 63723a0

Please sign in to comment.