From 1045b904be7c85521cea91992a6263f38cb07013 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 18 Feb 2009 13:35:55 -0600 Subject: [PATCH] fix logging check, unit tests --- basis/logging/logging-tests.factor | 2 +- basis/logging/logging.factor | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/basis/logging/logging-tests.factor b/basis/logging/logging-tests.factor index 796c8769fc..63eecc7319 100644 --- a/basis/logging/logging-tests.factor +++ b/basis/logging/logging-tests.factor @@ -13,7 +13,7 @@ USING: tools.test logging math ; \ error-logging-test ERROR add-error-logging -"logging-test" [ +"logging-test" DEBUG [ [ 4 ] [ 1 3 input-logging-test ] unit-test [ 4 ] [ 1 3 output-logging-test ] unit-test diff --git a/basis/logging/logging.factor b/basis/logging/logging.factor index 2389389074..496dae2c61 100644 --- a/basis/logging/logging.factor +++ b/basis/logging/logging.factor @@ -33,14 +33,16 @@ ERROR: undefined-log-level ; SYMBOL: log-service +ERROR: bad-log-message-parameters msg word level ; + : check-log-message ( msg word level -- msg word level ) 3dup [ string? ] [ word? ] [ word? ] tri* and and - [ "Bad parameters to log-message" throw ] unless ; inline + [ bad-log-message-parameters ] unless ; inline : log-message ( msg word level -- ) check-log-message - dup log? - log-service get dup and [ + log-service get + 2dup [ log? ] [ ] bi* and [ [ [ string-lines ] [ name>> ] [ name>> ] tri* ] dip 4array "log-message" send-to-log-server ] [