From 619d676af6baae569e33ff4fa981d997bdc130a2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 10 Feb 2008 01:39:37 -0600 Subject: [PATCH] logging.server fixes --- extra/logging/insomniac/insomniac.factor | 2 +- extra/logging/logging.factor | 10 +++++++--- extra/logging/server/server.factor | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/extra/logging/insomniac/insomniac.factor b/extra/logging/insomniac/insomniac.factor index d79eca3495..09c6763657 100755 --- a/extra/logging/insomniac/insomniac.factor +++ b/extra/logging/insomniac/insomniac.factor @@ -42,7 +42,7 @@ SYMBOL: insomniac-recipients : email-log-report ( service word-names -- ) "logging.insomniac" [ (email-log-report) ] with-logging ; -: schedule-insomniac ( alist -- ) +: schedule-insomniac ( service word-names -- ) { 25 } { 6 } f f f -rot [ [ email-log-report ] assoc-each rotate-logs ] 2curry schedule ; diff --git a/extra/logging/logging.factor b/extra/logging/logging.factor index d4f0bd1fbf..fec0c3660f 100755 --- a/extra/logging/logging.factor +++ b/extra/logging/logging.factor @@ -4,7 +4,7 @@ USING: logging.server sequences namespaces concurrency words kernel arrays shuffle tools.annotations prettyprint.config prettyprint debugger io.streams.string splitting continuations effects arrays.lib parser strings -combinators.lib ; +combinators.lib quotations ; IN: logging SYMBOL: DEBUG @@ -112,9 +112,13 @@ PRIVATE> : log-critical ( error word -- ) CRITICAL (log-error) ; +: stack-balancer ( effect word -- quot ) + >r dup effect-in length r> [ over >r ERROR log-stack r> ndrop ] 2curry + swap effect-out length f append >quotation ; + : error-logging-quot ( quot word -- quot' ) - dup stack-effect effect-in length - [ >r log-error r> ndrop ] 2curry + [ [ log-error ] curry ] keep + [ stack-effect ] keep stack-balancer compose [ recover ] 2curry ; : add-error-logging ( word level -- ) diff --git a/extra/logging/server/server.factor b/extra/logging/server/server.factor index 198ae47a79..05029df1d0 100755 --- a/extra/logging/server/server.factor +++ b/extra/logging/server/server.factor @@ -84,7 +84,7 @@ SYMBOL: log-files (close-logs) log-root directory [ drop rotate-log ] assoc-each ; -: log-server-loop +: log-server-loop ( -- ) [ receive unclip { { "log-message" [ (log-message) ] }