forked from hummypkg/webif
Rotate auto.log to auto_<timestamp>.log when it excedes settings logsize
This commit is contained in:
parent
1994d99294
commit
c3d360fa63
@ -5,12 +5,13 @@ set ::auto::logprefix ""
|
||||
set ::auto::loglevel 1
|
||||
|
||||
proc ::auto::loginit {} {
|
||||
|
||||
variable settings
|
||||
set logsize [$settings logsize]
|
||||
# Rotate log file if large enough.
|
||||
if {[file exists $::auto::logfile] &&
|
||||
[file size $::auto::logfile] > 2097152} {
|
||||
file copy -force $::auto::logfile "/mod/tmp/auto_old.log"
|
||||
file delete $::auto::logfile
|
||||
[file size $::auto::logfile] > $logsize} {
|
||||
set tstamp [clock format [clock seconds] -format {%Y%m%d%H%M%S}]
|
||||
file rename -force $::auto::logfile "/mod/tmp/auto.$tstamp.log"
|
||||
}
|
||||
|
||||
# Open log file
|
||||
|
Loading…
Reference in New Issue
Block a user