Skip to content

Commit

Permalink
plugin: log_uploader: Ignore deprecated ::settings(log_enabled)
Browse files Browse the repository at this point in the history
As logging is enabled on v1.35 at all times, replace the previous check
for ::settings(log_enabled) with a readability check on the log file.

Rather than flushing the log explicitly by filehandle,
utilize the utility ::logging::flush_log to provide
independence from underlying implementation.

Signed-Off-By: Jeff Kletsky <[email protected]>
  • Loading branch information
jeffsf authored and Mimoja committed Apr 15, 2021
1 parent 21d373e commit 9d2a001
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions de1plus/plugins/log_upload/plugin.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ namespace eval ::plugins::${plugin_name} {
proc uploadLogfiles {} {
variable settings
set settings(last_upload_result) ""
set settings(last_upload_log) ""
set settings(last_upload_log) ""

if {$::settings(log_enabled) != 1} {
set log_file_contents "Logging Disabled!"
set _logfile_name "[homedir]/$::settings(logfile)"

if {[file readable $_logfile_name]} {
::logging::flush_log
set log_file_contents [read_binary_file $_logfile_name]
} else {
flush $::logging::_log_fh
set log_file_contents [read_binary_file "[homedir]/$::settings(logfile)"]
set log_file_contents "Unable to read $_logfile_name"
}

set shotfiles [lsort -dictionary -decreasing [glob -nocomplain -tails -directory "[homedir]/history/" *.shot]]
Expand Down Expand Up @@ -192,4 +194,4 @@ namespace eval ::plugins::${plugin_name} {
plugins gui log_upload [create_ui]
}

}
}

0 comments on commit 9d2a001

Please sign in to comment.