fix logging check, unit tests

db4
Doug Coleman 2009-02-18 13:35:55 -06:00
parent 6324fb6c13
commit 1045b904be
2 changed files with 6 additions and 4 deletions

View File

@ -13,7 +13,7 @@ USING: tools.test logging math ;
\ error-logging-test ERROR add-error-logging \ error-logging-test ERROR add-error-logging
"logging-test" [ "logging-test" DEBUG [
[ 4 ] [ 1 3 input-logging-test ] unit-test [ 4 ] [ 1 3 input-logging-test ] unit-test
[ 4 ] [ 1 3 output-logging-test ] unit-test [ 4 ] [ 1 3 output-logging-test ] unit-test

View File

@ -33,14 +33,16 @@ ERROR: undefined-log-level ;
SYMBOL: log-service SYMBOL: log-service
ERROR: bad-log-message-parameters msg word level ;
: check-log-message ( msg word level -- msg word level ) : check-log-message ( msg word level -- msg word level )
3dup [ string? ] [ word? ] [ word? ] tri* and and 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 -- ) : log-message ( msg word level -- )
check-log-message check-log-message
dup log? log-service get
log-service get dup and [ 2dup [ log? ] [ ] bi* and [
[ [ string-lines ] [ name>> ] [ name>> ] tri* ] dip [ [ string-lines ] [ name>> ] [ name>> ] tri* ] dip
4array "log-message" send-to-log-server 4array "log-message" send-to-log-server
] [ ] [