aboutsummaryrefslogtreecommitdiff
path: root/GradeBook.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-xGradeBook.tcl39
1 files changed, 17 insertions, 22 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index d07804c..8e00c22 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -30,6 +30,8 @@ if { [file exists $config_file] && ("$config_file" ne "") } {
source $config_file
}
+set logEntry {}
+
::ncgi::parse
# defaults
@@ -80,30 +82,22 @@ if { $action == "logoff" } { LogMeOff; set action defaultview }
::ncgi::header
set user [ Authenticate_User $user_requested $password ]
-dbg "[timestamp] authenticated user $user_requested DB $coursedbfname as $user version $VERSION from $remote_ip" msg_level_log
-dbg "[timestamp] requested action $action by user $user_requested DB $coursedbfname recognized as $user version $VERSION from $remote_ip" msg_level_log
-set logEntry {}
-lappend logEntry timestamp [::json::write string [timestamp]]
-lappend logEntry remoteIP [::json::write string "$remote_ip"]
-lappend logEntry userName [::json::write string "$user_requested"]
+#dbg "[timestamp] authenticated user $user_requested DB $coursedbfname as $user version $VERSION from $remote_ip" msg_level_log
+#dbg "[timestamp] requested action $action by user $user_requested DB $coursedbfname recognized as $user version $VERSION from $remote_ip" msg_level_log
+
+addLogEntry timestamp "[timestamp]" msg_level_log
+addLogEntry remoteIP "$remote_ip" msg_level_log
+addLogEntry userName "$user_requested" msg_level_log
if { "$user_requested" eq "$user" } {
- lappend logEntry userStatus [::json::write string "authenticated"]
+ addLogEntry userStatus "authenticated" msg_level_log
} else {
- lappend logEntry userStatus [::json::write string "$user"]
+ addLogEntry userStatus "$user" msg_level_log
}
-lappend logEntry requestedAction [::json::write string "$action"]
-lappend logEntry DB [::json::write string "$coursedbfname"]
-lappend logEntry sortCol [::json::write string "$sortCol"]
-lappend logEntry programVersion [::json::write string "$VERSION"]
-lappend logEntry logLevel [::json::write string msg_level_log]
-
-::json::write indented false
-set logEntryJsonString [json::write object {*}$logEntry]
-set fid [open $GradebookServerConfig(log_file) a+]
-puts $fid "$logEntryJsonString"
-close $fid
-
+addLogEntry requestedAction "$action" msg_level_log
+addLogEntry DB "$coursedbfname" msg_level_log
+addLogEntry sortCol "$sortCol" msg_level_log
+addLogEntry programVersion "$VERSION" msg_level_log
set dbfile "$GradebookServerConfig(grades_db_dir)/$coursedbfname"
@@ -134,11 +128,12 @@ dbg $permission_list msg_level_info
htmlFooter $permission_list
puts "</body>"
+logEntryToLogFile
###################### Main script ends #################################
} errStat ]
if { $err } {
- dbg "Error: $errStat" msg_level_critical
- htmlErrorMsg "Something went wrong, please, ask admin to have a look at logs"
+ rawTextToLogFile "Error: $errStat"
+ htmlErrorMsg "Something went wrong, please, ask admin to have a look at logs around [timestamp]"
}
# vim: ts=2 sw=2 foldmethod=indent: