JSON timing data
This commit is contained in:
parent
371fcba252
commit
ef84301f83
|
@ -282,6 +282,21 @@
|
||||||
[(struct stderr (bs))
|
[(struct stderr (bs))
|
||||||
`(pre ([class "stderr"]) ,(bytes->string/utf-8 bs))])))
|
`(pre ([class "stderr"]) ,(bytes->string/utf-8 bs))])))
|
||||||
|
|
||||||
|
(define (json-timing req path-to-file)
|
||||||
|
(let* ([timing-pth (path-timing-log (apply build-path path-to-file))]
|
||||||
|
[s (file->string timing-pth)]
|
||||||
|
[s (regexp-replace* (regexp-quote "(") s "[")]
|
||||||
|
[s (regexp-replace* (regexp-quote ")") s "]")]
|
||||||
|
[s (format "[~a]" s)])
|
||||||
|
(response
|
||||||
|
200 #"Okay"
|
||||||
|
(file-or-directory-modify-seconds timing-pth)
|
||||||
|
#"application/json"
|
||||||
|
(list (make-header #"Access-Control-Allow-Origin"
|
||||||
|
#"*"))
|
||||||
|
(lambda (out)
|
||||||
|
(write-string s out)))))
|
||||||
|
|
||||||
(define (render-log log-pth)
|
(define (render-log log-pth)
|
||||||
(match (log-rendering log-pth)
|
(match (log-rendering log-pth)
|
||||||
[#f
|
[#f
|
||||||
|
@ -940,6 +955,7 @@
|
||||||
[("help") show-help]
|
[("help") show-help]
|
||||||
[("") show-revisions]
|
[("") show-revisions]
|
||||||
[("diff" (integer-arg) (integer-arg) (string-arg) ...) show-diff]
|
[("diff" (integer-arg) (integer-arg) (string-arg) ...) show-diff]
|
||||||
|
[("json" "timing" (string-arg) ...) json-timing]
|
||||||
[("current" "") show-revision/current]
|
[("current" "") show-revision/current]
|
||||||
[("current" (string-arg) ...) show-file/current]
|
[("current" (string-arg) ...) show-file/current]
|
||||||
[((integer-arg) "") show-revision]
|
[((integer-arg) "") show-revision]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user