aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2016-08-24 18:11:27 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2016-08-24 18:11:27 -0400
commit18782a6deee1736cbe8e4cd17607de7ece624019 (patch)
treea9f6f079304cd09d1f48d3316448fc9a874b8ca5
parent4b6e4a068079171a35813f13794a1139c9f36747 (diff)
downloadGradeBook-18782a6deee1736cbe8e4cd17607de7ece624019.tar.gz
GradeBook-18782a6deee1736cbe8e4cd17607de7ece624019.zip
improved json output
-rwxr-xr-xGradeBook.tcl24
1 files changed, 13 insertions, 11 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index 3483606..59b1945 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -82,21 +82,23 @@ 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"]
+package require json::write
+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"]
if { "$user_requested" eq "$user" } {
- set logEntry(userStatus) [json::string2json "authenticated"]
+ lappend logEntry userStatus [::json::write string "authenticated"]
} else {
- set logEntry(userStatus) [json::string2json "$user"]
+ lappend logEntry userStatus [::json::write string "$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]
+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]
-set logEntryString [json::dict2json [array get logEntry]]
+set logEntryString [json::write object {*}$logEntry]
set fid [open $GradebookServerConfig(log_file) a+]
puts $fid "$logEntryString"
close $fid