fix logging check, unit tests
parent
6324fb6c13
commit
1045b904be
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
] [
|
] [
|
||||||
|
|
Loading…
Reference in New Issue