diff --git a/os2.rkt b/os2.rkt index 2b2b31a..3296bf4 100644 --- a/os2.rkt +++ b/os2.rkt @@ -305,11 +305,13 @@ (struct-copy vm state [processes (for/hash ([(pid p) (in-hash (vm-processes state))] #:when (or (process-alive? pid p) - (begin (printf "~a PID ~v (~a) garbage-collected~n" - (vm-name state) - pid - (process-name p)) - #f))) + (begin + (log-info + (format "~a PID ~v (~a) garbage-collected" + (vm-name state) + pid + (process-name p))) + #f))) (values pid p))])) (define (send-to-user failure-proc f . args) @@ -444,29 +446,28 @@ (struct-copy vm (enqueue-actions state new-pid initial-actions) [processes (hash-set (vm-processes state) new-pid initial-process)] [next-process-id (+ new-pid 1)])) - (printf "~a PID ~v (~a) started~n" (vm-name state) new-pid new-name) - (flush-output (current-output-port)) + (log-info (format "~a PID ~v (~a) started" (vm-name state) new-pid new-name)) (run-trapk spawned-state spawning-pid k new-pid)) (define (print-kill vm-name pid-to-kill process-name reason) (cond - [(eq? reason #f) (printf "~a PID ~v (~a) exited normally~n" - vm-name - pid-to-kill - process-name)] - [(exn? reason) ((error-display-handler) - (format "~a PID ~v (~a) exited with exception~n~a" + [(eq? reason #f) (log-info (format "~a PID ~v (~a) exited normally" + vm-name + pid-to-kill + process-name))] + [(exn? reason) (begin ((error-display-handler) + (format "~a PID ~v (~a) exited with exception~n~a" + vm-name + pid-to-kill + process-name + (exn-message reason)) + reason) + (flush-output (current-output-port)))] + [else (log-info (format "~a PID ~v (~a) exited with reason: ~a" vm-name pid-to-kill process-name - (exn-message reason)) - reason)] - [else (printf "~a PID ~v (~a) exited with reason: ~a~n" - vm-name - pid-to-kill - process-name - reason)]) - (flush-output (current-output-port))) + reason))])) (define (do-kill pid-to-kill reason state) (cond