Skip to content

Commit

Permalink
Merge pull request #2 from uwe111/uwe111-patch-2
Browse files Browse the repository at this point in the history
add an external logfilter to improve stability
  • Loading branch information
uwe111 committed Feb 20, 2015
2 parents 778b488 + a477409 commit b789fe3
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions cuxchart/ajax/log.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
#
# Dieses Script gibt eine Log-Datei aus
#
# Pfad+Dateiname werden über den Parameter "logfile" übergeben
# Pfad+Dateiname werden über den Parameter "logfile" übergeben
#
# 5'2013 hobbyquaker https://github.com/hobbyquaker
# 2'2015 Uwe Langhammer ulangham@gmx.de
#

set logfilter "/usr/local/addons/cuxd/extra/logfilter"

catch {
set input $env(QUERY_STRING)
set pairs [split $input &]
Expand All @@ -22,17 +25,18 @@ catch {
puts "Content-Type: text/plain;Charset=ISO-8859-1"
puts "Access-Control-Allow-Origin: *"
if {[info exists cache]} {
puts "Cache-Control: public, max-age=31536000"
puts "Cache-Control: public, max-age=31536000"
} else {
puts "Cache-Control: no-cache, max-age=0"
puts "Cache-Control: no-cache, max-age=0"
}
puts ""



if {[info exists logfile]} {
if {[file isfile $logfilter]} {
puts -nonewline [exec $logfilter $logfile]
} else {
set fp [open $logfile r]
set log_data [read $fp]
puts -nonewline [read $fp]
close $fp
puts -nonewline $log_data
}
}
}

0 comments on commit b789fe3

Please sign in to comment.