Rename matrix -> marketplace

This commit is contained in:
Tony Garnock-Jones 2013-05-30 17:54:53 -04:00
parent 8e2b9d72e5
commit b864e458bf
9 changed files with 50 additions and 46 deletions

View File

@ -20,13 +20,13 @@
(: log-quit : (All (KilledState) (process KilledState) -> Void))
(define (log-quit p)
(matrix-log (if reason 'warning 'info)
"PID ~v (~a) quits with reason: ~a"
killed-pid
(process-debug-name p)
(if (exn? reason)
(exn->string reason)
(format "~v" reason))))
(marketplace-log (if reason 'warning 'info)
"PID ~v (~a) quits with reason: ~a"
killed-pid
(process-debug-name p)
(if (exn? reason)
(exn->string reason)
(format "~v" reason))))
(if (equal? killed-pid (process-pid p))
(let-values (((p state meta-actions) (delete-all-endpoints reason p state)))

View File

@ -19,7 +19,7 @@
-> (Values (Option (process OldState)) vm)))
(define (do-spawn spec parent-k p debug-name state)
(define new-pid (vm-next-process-id state))
(matrix-log 'info "PID ~v (~a) starting" new-pid debug-name)
(marketplace-log 'info "PID ~v (~a) starting" new-pid debug-name)
(: new-cotransition : CoTransition)
(define new-cotransition
(send-to-user* debug-name new-pid (e) (co-quit e)

View File

@ -66,7 +66,11 @@
(inject-process state (mkProcess p))
external-actions)]
[(cons action remaining-actions)
(matrix-log 'debug "PID ~v (~a) Action: ~v" pid (process-debug-name p) action)
(marketplace-log 'debug
"PID ~v (~a) Action: ~v"
pid
(process-debug-name p)
action)
(let-values (((p state new-external-actions)
(perform-action action p state)))
(if p
@ -96,10 +100,10 @@
(unwrap-process State (HashTable PID Process) (p wp)
(if (process-alive? p)
(hash-set processes pid wp)
(begin (matrix-log 'info
"PID ~v (~a) garbage-collected"
pid
(process-debug-name p))
(begin (marketplace-log 'info
"PID ~v (~a) garbage-collected"
pid
(process-debug-name p))
processes))))]))
(: vm-idle? : vm -> Boolean)

View File

@ -43,7 +43,7 @@
(null? active-events))
(begin
;; Not polling, and no events that could wake us from blocking, so quit
(matrix-log 'debug "Ground VM returning normally.")
(marketplace-log 'debug "Ground VM returning normally.")
(sleep 0.2) ;; give the log-receivers a chance to drain (!)
(void))
(let ((interruptk (apply sync

View File

@ -1,17 +1,17 @@
#lang typed/racket/base
(require/typed "log-untyped.rkt"
[matrix-root-logger Logger])
[marketplace-root-logger Logger])
;; WARNING: duplicated in log-untyped.rkt
(define-syntax matrix-log
(define-syntax marketplace-log
(syntax-rules ()
[(_ level-exp message)
(let ((level level-exp))
(when (log-level? matrix-root-logger level)
(log-message matrix-root-logger level message #f)))]
(when (log-level? marketplace-root-logger level)
(log-message marketplace-root-logger level message #f)))]
[(_ level format-string exp ...)
(matrix-log level (format format-string exp ...))]))
(marketplace-log level (format format-string exp ...))]))
(provide matrix-root-logger
matrix-log)
(provide marketplace-root-logger
marketplace-log)

View File

@ -2,20 +2,20 @@
(require racket/match)
(provide matrix-root-logger
matrix-log)
(provide marketplace-root-logger
marketplace-log)
(define matrix-root-logger (make-logger 'typed-matrix #f))
(define marketplace-root-logger (make-logger 'marketplace #f))
;; WARNING: duplicated in log-typed.rkt
(define-syntax matrix-log
(define-syntax marketplace-log
(syntax-rules ()
[(_ level-exp message)
(let ((level level-exp))
(when (log-level? matrix-root-logger level)
(log-message matrix-root-logger level message #f)))]
(when (log-level? marketplace-root-logger level)
(log-message marketplace-root-logger level message #f)))]
[(_ level format-string exp ...)
(matrix-log level (format format-string exp ...))]))
(marketplace-log level (format format-string exp ...))]))
(define (level-code level)
(match level
@ -26,10 +26,10 @@
['fatal "F"]
[other (symbol->string other)]))
(match (getenv "MATRIX_LOG")
(match (getenv "MARKETPLACE_LOG")
[#f (void)]
[str (let ((level (string->symbol str)))
(define receiver (make-log-receiver matrix-root-logger level))
(define receiver (make-log-receiver marketplace-root-logger level))
(thread
(lambda ()
(let loop ()

View File

@ -20,14 +20,14 @@
(define-syntax-rule (send-to-user* debug-name pid (e) failure-result enclosed-expr)
(with-handlers ([exn:fail? (lambda: ([e : Reason])
(if (exn? e)
(matrix-log 'error "Process ~v(~v):~n~a~n"
debug-name pid (exn-message e))
(matrix-log 'error "Process ~v(~v):~n~v~n"
debug-name pid e))
(marketplace-log 'error "Process ~v(~v):~n~a~n"
debug-name pid (exn-message e))
(marketplace-log 'error "Process ~v(~v):~n~v~n"
debug-name pid e))
failure-result)])
(matrix-log 'debug "Entering process ~v(~v)" debug-name pid)
(marketplace-log 'debug "Entering process ~v(~v)" debug-name pid)
(define result enclosed-expr)
(matrix-log 'debug "Leaving process ~v(~v)" debug-name pid)
(marketplace-log 'debug "Leaving process ~v(~v)" debug-name pid)
result))
(: action-tree->quasiqueue : (All (State) (ActionTree State) -> (QuasiQueue (Action State))))

View File

@ -50,7 +50,7 @@
(define result
(and (orientations-intersect? (role-orientation left) (role-orientation right))
(mgu-canonical (freshen (role-topic left)) (freshen (role-topic right)))))
(matrix-log 'debug "role-intersection ~v // ~v --> ~v" left right result)
(marketplace-log 'debug "role-intersection ~v // ~v --> ~v" left right result)
result)
;; True iff the flow between remote-role and local-role should be

View File

@ -6,8 +6,8 @@
marketplace/support/debug
marketplace/log-untyped
(except-in marketplace/log-typed
matrix-log
matrix-root-logger))]
marketplace-log
marketplace-root-logger))]
@title{Management and Monitoring}
@ -29,38 +29,38 @@ each @racket['publisher] message sent to the VM's network.
}
@section[#:tag "logging"]{logging (MATRIX_LOG)}
@section[#:tag "logging"]{logging (MARKETPLACE_LOG)}
@defmodule*[(marketplace/log-untyped
marketplace/log-typed)]{
@defform[#:kind "environment variable" #:id MATRIX_LOG MATRIX_LOG]{
@defform[#:kind "environment variable" #:id MARKETPLACE_LOG MARKETPLACE_LOG]{
Set the @tt{MATRIX_LOG} environment variable to "debug", "info",
Set the @tt{MARKETPLACE_LOG} environment variable to "debug", "info",
"warning", "error" or "fatal" (i.e. any of Racket's
@racket[log-level?]s) to enable output of log messages at that level
and higher.
If @tt{MATRIX_LOG} is not defined in the environment, @emph{no log
If @tt{MARKETPLACE_LOG} is not defined in the environment, @emph{no log
output will be produced}.
}
@defform[(matrix-log level format-str arg ...)
@defform[(marketplace-log level format-str arg ...)
#:grammar
((level expr)
(format-str expr)
(arg expr))]{
Analogous to Racket's core @racket[log-message], but uses
@racket[matrix-root-logger] instead of the system logger. The
@racket[marketplace-root-logger] instead of the system logger. The
@racket[level] expression must evaluate to a level symbol (see
@racket[log-level?]), and @racket[format-str] must evaluate to a
format string for use with @racket[format].
}
@defthing[matrix-root-logger logger?]{
@defthing[marketplace-root-logger logger?]{
The root logger for marketplace logging.