Rename matrix -> marketplace
This commit is contained in:
parent
8e2b9d72e5
commit
b864e458bf
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
(: log-quit : (All (KilledState) (process KilledState) -> Void))
|
(: log-quit : (All (KilledState) (process KilledState) -> Void))
|
||||||
(define (log-quit p)
|
(define (log-quit p)
|
||||||
(matrix-log (if reason 'warning 'info)
|
(marketplace-log (if reason 'warning 'info)
|
||||||
"PID ~v (~a) quits with reason: ~a"
|
"PID ~v (~a) quits with reason: ~a"
|
||||||
killed-pid
|
killed-pid
|
||||||
(process-debug-name p)
|
(process-debug-name p)
|
||||||
(if (exn? reason)
|
(if (exn? reason)
|
||||||
(exn->string reason)
|
(exn->string reason)
|
||||||
(format "~v" reason))))
|
(format "~v" reason))))
|
||||||
|
|
||||||
(if (equal? killed-pid (process-pid p))
|
(if (equal? killed-pid (process-pid p))
|
||||||
(let-values (((p state meta-actions) (delete-all-endpoints reason p state)))
|
(let-values (((p state meta-actions) (delete-all-endpoints reason p state)))
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-> (Values (Option (process OldState)) vm)))
|
-> (Values (Option (process OldState)) vm)))
|
||||||
(define (do-spawn spec parent-k p debug-name state)
|
(define (do-spawn spec parent-k p debug-name state)
|
||||||
(define new-pid (vm-next-process-id 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)
|
(: new-cotransition : CoTransition)
|
||||||
(define new-cotransition
|
(define new-cotransition
|
||||||
(send-to-user* debug-name new-pid (e) (co-quit e)
|
(send-to-user* debug-name new-pid (e) (co-quit e)
|
||||||
|
|
|
@ -66,7 +66,11 @@
|
||||||
(inject-process state (mkProcess p))
|
(inject-process state (mkProcess p))
|
||||||
external-actions)]
|
external-actions)]
|
||||||
[(cons action remaining-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)
|
(let-values (((p state new-external-actions)
|
||||||
(perform-action action p state)))
|
(perform-action action p state)))
|
||||||
(if p
|
(if p
|
||||||
|
@ -96,10 +100,10 @@
|
||||||
(unwrap-process State (HashTable PID Process) (p wp)
|
(unwrap-process State (HashTable PID Process) (p wp)
|
||||||
(if (process-alive? p)
|
(if (process-alive? p)
|
||||||
(hash-set processes pid wp)
|
(hash-set processes pid wp)
|
||||||
(begin (matrix-log 'info
|
(begin (marketplace-log 'info
|
||||||
"PID ~v (~a) garbage-collected"
|
"PID ~v (~a) garbage-collected"
|
||||||
pid
|
pid
|
||||||
(process-debug-name p))
|
(process-debug-name p))
|
||||||
processes))))]))
|
processes))))]))
|
||||||
|
|
||||||
(: vm-idle? : vm -> Boolean)
|
(: vm-idle? : vm -> Boolean)
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
(null? active-events))
|
(null? active-events))
|
||||||
(begin
|
(begin
|
||||||
;; Not polling, and no events that could wake us from blocking, so quit
|
;; 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 (!)
|
(sleep 0.2) ;; give the log-receivers a chance to drain (!)
|
||||||
(void))
|
(void))
|
||||||
(let ((interruptk (apply sync
|
(let ((interruptk (apply sync
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
#lang typed/racket/base
|
#lang typed/racket/base
|
||||||
|
|
||||||
(require/typed "log-untyped.rkt"
|
(require/typed "log-untyped.rkt"
|
||||||
[matrix-root-logger Logger])
|
[marketplace-root-logger Logger])
|
||||||
|
|
||||||
;; WARNING: duplicated in log-untyped.rkt
|
;; WARNING: duplicated in log-untyped.rkt
|
||||||
(define-syntax matrix-log
|
(define-syntax marketplace-log
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
[(_ level-exp message)
|
[(_ level-exp message)
|
||||||
(let ((level level-exp))
|
(let ((level level-exp))
|
||||||
(when (log-level? matrix-root-logger level)
|
(when (log-level? marketplace-root-logger level)
|
||||||
(log-message matrix-root-logger level message #f)))]
|
(log-message marketplace-root-logger level message #f)))]
|
||||||
[(_ level format-string exp ...)
|
[(_ level format-string exp ...)
|
||||||
(matrix-log level (format format-string exp ...))]))
|
(marketplace-log level (format format-string exp ...))]))
|
||||||
|
|
||||||
(provide matrix-root-logger
|
(provide marketplace-root-logger
|
||||||
matrix-log)
|
marketplace-log)
|
||||||
|
|
|
@ -2,20 +2,20 @@
|
||||||
|
|
||||||
(require racket/match)
|
(require racket/match)
|
||||||
|
|
||||||
(provide matrix-root-logger
|
(provide marketplace-root-logger
|
||||||
matrix-log)
|
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
|
;; WARNING: duplicated in log-typed.rkt
|
||||||
(define-syntax matrix-log
|
(define-syntax marketplace-log
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
[(_ level-exp message)
|
[(_ level-exp message)
|
||||||
(let ((level level-exp))
|
(let ((level level-exp))
|
||||||
(when (log-level? matrix-root-logger level)
|
(when (log-level? marketplace-root-logger level)
|
||||||
(log-message matrix-root-logger level message #f)))]
|
(log-message marketplace-root-logger level message #f)))]
|
||||||
[(_ level format-string exp ...)
|
[(_ level format-string exp ...)
|
||||||
(matrix-log level (format format-string exp ...))]))
|
(marketplace-log level (format format-string exp ...))]))
|
||||||
|
|
||||||
(define (level-code level)
|
(define (level-code level)
|
||||||
(match level
|
(match level
|
||||||
|
@ -26,10 +26,10 @@
|
||||||
['fatal "F"]
|
['fatal "F"]
|
||||||
[other (symbol->string other)]))
|
[other (symbol->string other)]))
|
||||||
|
|
||||||
(match (getenv "MATRIX_LOG")
|
(match (getenv "MARKETPLACE_LOG")
|
||||||
[#f (void)]
|
[#f (void)]
|
||||||
[str (let ((level (string->symbol str)))
|
[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
|
(thread
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let loop ()
|
(let loop ()
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
(define-syntax-rule (send-to-user* debug-name pid (e) failure-result enclosed-expr)
|
(define-syntax-rule (send-to-user* debug-name pid (e) failure-result enclosed-expr)
|
||||||
(with-handlers ([exn:fail? (lambda: ([e : Reason])
|
(with-handlers ([exn:fail? (lambda: ([e : Reason])
|
||||||
(if (exn? e)
|
(if (exn? e)
|
||||||
(matrix-log 'error "Process ~v(~v):~n~a~n"
|
(marketplace-log 'error "Process ~v(~v):~n~a~n"
|
||||||
debug-name pid (exn-message e))
|
debug-name pid (exn-message e))
|
||||||
(matrix-log 'error "Process ~v(~v):~n~v~n"
|
(marketplace-log 'error "Process ~v(~v):~n~v~n"
|
||||||
debug-name pid e))
|
debug-name pid e))
|
||||||
failure-result)])
|
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)
|
(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))
|
result))
|
||||||
|
|
||||||
(: action-tree->quasiqueue : (All (State) (ActionTree State) -> (QuasiQueue (Action State))))
|
(: action-tree->quasiqueue : (All (State) (ActionTree State) -> (QuasiQueue (Action State))))
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
(define result
|
(define result
|
||||||
(and (orientations-intersect? (role-orientation left) (role-orientation right))
|
(and (orientations-intersect? (role-orientation left) (role-orientation right))
|
||||||
(mgu-canonical (freshen (role-topic left)) (freshen (role-topic 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)
|
result)
|
||||||
|
|
||||||
;; True iff the flow between remote-role and local-role should be
|
;; True iff the flow between remote-role and local-role should be
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
marketplace/support/debug
|
marketplace/support/debug
|
||||||
marketplace/log-untyped
|
marketplace/log-untyped
|
||||||
(except-in marketplace/log-typed
|
(except-in marketplace/log-typed
|
||||||
matrix-log
|
marketplace-log
|
||||||
matrix-root-logger))]
|
marketplace-root-logger))]
|
||||||
|
|
||||||
@title{Management and Monitoring}
|
@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
|
@defmodule*[(marketplace/log-untyped
|
||||||
marketplace/log-typed)]{
|
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
|
"warning", "error" or "fatal" (i.e. any of Racket's
|
||||||
@racket[log-level?]s) to enable output of log messages at that level
|
@racket[log-level?]s) to enable output of log messages at that level
|
||||||
and higher.
|
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}.
|
output will be produced}.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@defform[(matrix-log level format-str arg ...)
|
@defform[(marketplace-log level format-str arg ...)
|
||||||
#:grammar
|
#:grammar
|
||||||
((level expr)
|
((level expr)
|
||||||
(format-str expr)
|
(format-str expr)
|
||||||
(arg expr))]{
|
(arg expr))]{
|
||||||
|
|
||||||
Analogous to Racket's core @racket[log-message], but uses
|
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[level] expression must evaluate to a level symbol (see
|
||||||
@racket[log-level?]), and @racket[format-str] must evaluate to a
|
@racket[log-level?]), and @racket[format-str] must evaluate to a
|
||||||
format string for use with @racket[format].
|
format string for use with @racket[format].
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@defthing[matrix-root-logger logger?]{
|
@defthing[marketplace-root-logger logger?]{
|
||||||
|
|
||||||
The root logger for marketplace logging.
|
The root logger for marketplace logging.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue