make LOG available for user code

svn: r1023
This commit is contained in:
Eli Barzilay 2005-10-08 03:38:02 +00:00
parent f9455176b7
commit bedb4235c3
3 changed files with 17 additions and 6 deletions

View File

@ -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

View File

@ -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:

View File

@ -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)]