logging.insomniac: clean up more
parent
b79c801b3c
commit
7fc552dd6c
|
|
@ -2,30 +2,25 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: logging.analysis logging.server logging smtp kernel
|
USING: logging.analysis logging.server logging smtp kernel
|
||||||
io.files io.streams.string namespaces make timers assocs
|
io.files io.streams.string namespaces make timers assocs
|
||||||
io.encodings.utf8 accessors calendar sequences ;
|
io.encodings.utf8 accessors calendar sequences locals ;
|
||||||
QUALIFIED: io.sockets
|
QUALIFIED: io.sockets
|
||||||
IN: logging.insomniac
|
IN: logging.insomniac
|
||||||
|
|
||||||
SYMBOL: insomniac-sender
|
SYMBOL: insomniac-sender
|
||||||
SYMBOL: insomniac-recipients
|
SYMBOL: insomniac-recipients
|
||||||
|
|
||||||
: ?analyze-log ( service word-names -- string/f )
|
|
||||||
[ analyze-log-file ] with-string-writer ;
|
|
||||||
|
|
||||||
: email-subject ( service -- string )
|
: email-subject ( service -- string )
|
||||||
[
|
[
|
||||||
"Log analysis for " % % " on " % io.sockets:host-name %
|
"Log analysis for " % % " on " % io.sockets:host-name %
|
||||||
] "" make ;
|
] "" make ;
|
||||||
|
|
||||||
: (email-log-report) ( service word-names -- )
|
:: (email-log-report) ( service word-names -- )
|
||||||
dupd ?analyze-log [ drop ] [
|
|
||||||
<email>
|
<email>
|
||||||
swap >>body
|
[ service word-names analyze-log-file ] with-string-writer >>body
|
||||||
insomniac-recipients get >>to
|
insomniac-recipients get >>to
|
||||||
insomniac-sender get >>from
|
insomniac-sender get >>from
|
||||||
swap email-subject >>subject
|
service email-subject >>subject
|
||||||
send-email
|
send-email ;
|
||||||
] if-empty ;
|
|
||||||
|
|
||||||
\ (email-log-report) NOTICE add-error-logging
|
\ (email-log-report) NOTICE add-error-logging
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue