Skip to content

Commit 7946258

Browse files
Only store logs if the user wants
1 parent 40b3c05 commit 7946258

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

kratos.gid/kratos.tcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ proc Kratos::InitGlobalVariables {dir} {
159159
array set kratos_private [ReadProblemtypeXml [file join $kratos_private(Path) kratos.xml] Infoproblemtype {Name Version CheckMinimumGiDVersion}]
160160
# Version of the kratos executable
161161
set kratos_private(exec_version) "dev"
162+
# Allow logs -> 0 No | 1 Only local | 2 Share with dev team
163+
set Kratos::kratos_private(allow_logs) 1
162164
}
163165

164166
proc Kratos::LoadCommonScripts { } {

kratos.gid/scripts/Controllers/PreferencesWindow.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ proc Kratos::ManagePreferences { cmd name {value ""}} {
1111
}
1212
"SetValue" {
1313
set ::Kratos::kratos_private($name) $value
14+
if {$name eq "allow_logs"} {Kratos::InitLog}
1415
}
1516
"GetDefaultValue" {
1617
# same as GetValue

kratos.gid/scripts/Logs.tcl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ proc Kratos::GetLogFilePath { } {
77
variable kratos_private
88
set gid_defaults [GiD_GetUserSettingsFilename -create_folders]
99
set dir_name [file dirname $gid_defaults]
10-
set file_name $kratos_private(LogFilename)
10+
set file_name $kratos_private(LogFilename+)
1111
if {$file_name eq ""} {}
1212
if { $::tcl_platform(platform) == "windows" } {
1313
return [file join $dir_name KratosLogs $file_name]
@@ -18,17 +18,24 @@ proc Kratos::GetLogFilePath { } {
1818

1919
proc Kratos::InitLog { } {
2020
variable kratos_private
21+
22+
if {! $Kratos::kratos_private(allow_logs)} {return ""}
23+
2124
set kratos_private(LogFilename) [clock format [clock seconds] -format "%Y%m%d%H%M%S"].log
2225
set logpath [Kratos::GetLogFilePath]
2326
file mkdir [file dirname $logpath]
2427
set logfile [open $logpath "a+"];
2528
puts $logfile "Kratos Log Session"
2629
close $logfile
2730
set kratos_private(Log) [list ]
31+
32+
Kratos::AutoFlush
2833
}
2934

3035
proc Kratos::Log {msg} {
3136
variable kratos_private
37+
38+
if {! $Kratos::kratos_private(allow_logs)} {return ""}
3239

3340
if {[info exists kratos_private(Log)]} {
3441
lappend kratos_private(Log) "*~* [clock format [clock seconds] -format {%Z %Y-%m-%d %H:%M:%S }] | $msg"
@@ -65,6 +72,7 @@ proc Kratos::FlushLog { } {
6572
}
6673

6774
proc Kratos::AutoFlush {} {
75+
if {! $Kratos::kratos_private(allow_logs)} {return ""}
6876
Kratos::FlushLog
6977
after 5000 {Kratos::AutoFlush}
7078
}
@@ -78,6 +86,5 @@ proc Kratos::ViewLog {} {
7886
#do not save preferences starting with flag gid.exe -c (that specify read only an alternative file)
7987
if { [GiD_Set SaveGidDefaults] } {
8088
Kratos::InitLog
81-
Kratos::AutoFlush
8289
}
8390

0 commit comments

Comments
 (0)