aboutsummaryrefslogtreecommitdiff
path: root/GradeBook.tcl
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2016-08-23 23:30:02 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2016-08-23 23:30:02 -0400
commit4b6e4a068079171a35813f13794a1139c9f36747 (patch)
treea8d9962dc633be220aa6be9407e9232054737359 /GradeBook.tcl
parent42ab77361513753478dd93f2aa9e0ebe55a6dbdd (diff)
downloadGradeBook-4b6e4a068079171a35813f13794a1139c9f36747.tar.gz
GradeBook-4b6e4a068079171a35813f13794a1139c9f36747.zip
draft of json log entry
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-xGradeBook.tcl21
1 files changed, 21 insertions, 0 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index 00a0f67..3483606 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -82,6 +82,27 @@ 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
+package require json
+set logEntry(timestamp) [json::string2json [timestamp]]
+set logEntry(remoteIP) [json::string2json "$remote_ip"]
+set logEntry(userName) [json::string2json "$user_requested"]
+if { "$user_requested" eq "$user" } {
+ set logEntry(userStatus) [json::string2json "authenticated"]
+} else {
+ set logEntry(userStatus) [json::string2json "$user"]
+}
+set logEntry(requestedAction) [json::string2json "$action"]
+set logEntry(DB) [json::string2json "$coursedbfname"]
+set logEntry(programVersion) [json::string2json "$VERSION"]
+set logEntry(logLevel) [json::string2json msg_level_log]
+
+set logEntryString [json::dict2json [array get logEntry]]
+set fid [open $GradebookServerConfig(log_file) a+]
+puts $fid "$logEntryString"
+close $fid
+
+
+
set dbfile "$GradebookServerConfig(grades_db_dir)/$coursedbfname"
if { [file exists $dbfile] && ("$coursedbfname" ne "") } {
sqlite3 db $dbfile