From bedb4235c33cf4b4433c77bbe867bb963c98cba2 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sat, 8 Oct 2005 03:38:02 +0000 Subject: [PATCH] make LOG available for user code svn: r1023 --- collects/handin-server/doc.txt | 15 +++++++++++---- collects/handin-server/handin-server.ss | 1 + collects/handin-server/utils.ss | 7 +++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/collects/handin-server/doc.txt b/collects/handin-server/doc.txt index 4f9145c82e..cb1770e669 100644 --- a/collects/handin-server/doc.txt +++ b/collects/handin-server/doc.txt @@ -629,6 +629,10 @@ The _utils.ss_ module provides utilities helpful in implementing submission error. +> (LOG fmt args ...) - produces a line in the server log file, using + the given format string and arguments. + + Extra Checker Utilities ============================================ @@ -754,22 +758,25 @@ value from the submission code. (require (lib "sendmail.ss" "net")) (post: + (define info + (format "hw.scm: ~a ~a" + (file-size "hw.scm") + (file-or-directory-modify-seconds "hw.scm"))) + (LOG "Sending a receipt: ~a" info) (send-mail-message - "cour-staff@university.edu + "course-staff@university.edu "Submission Receipt" (map (lambda (user) (user-substs user "{Full Name} <{Email}>")) users) (list (user-substs (first users) "{TA Name} <{TA Email}>")) null - (list "Your submission was received" - ... provide details on hw.scm ...)) + `("Your submission was received" ,info)) (message (string-append "Your submission was successfully saved." " You will get an email receipt within 30 minutes;" " if not, please contact the course staff.") '(ok))) - > (pairs-or-singles-with-warning users) This procedure is intended for use as the :users entry in a checker. It will do nothing if there are two users, and throw an error if diff --git a/collects/handin-server/handin-server.ss b/collects/handin-server/handin-server.ss index 224b576ddf..0970c89100 100644 --- a/collects/handin-server/handin-server.ss +++ b/collects/handin-server/handin-server.ss @@ -30,6 +30,7 @@ [(pair? default) (car default)] [else (error (alist-name alist) "no value for `~s'" key)])) + (provide LOG) (define (LOG str . args) ;; Assemble log into into a single string, to make ;; interleaved log lines unlikely: diff --git a/collects/handin-server/utils.ss b/collects/handin-server/utils.ss index ef41369030..3fd4e957f4 100644 --- a/collects/handin-server/utils.ss +++ b/collects/handin-server/utils.ss @@ -6,7 +6,8 @@ (prefix pc: (lib "pconvert.ss")) (lib "pretty.ss") (lib "list.ss") - (lib "string.ss")) + (lib "string.ss") + (only "handin-server.ss" LOG)) (provide unpack-submission @@ -31,7 +32,9 @@ check-defined look-for-tests user-construct - test-history-enabled) + test-history-enabled + + LOG) (define (unpack-submission str) (let* ([base (make-object editor-stream-in-bytes-base% str)]