From 5ee4949c382dbc0230a172f5fd2582bb725794a2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 2 Oct 2010 18:18:54 -0700 Subject: [PATCH] logging.insomniac: clean up more --- basis/logging/insomniac/insomniac.factor | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/basis/logging/insomniac/insomniac.factor b/basis/logging/insomniac/insomniac.factor index 0175fd1424..5f323d7ada 100644 --- a/basis/logging/insomniac/insomniac.factor +++ b/basis/logging/insomniac/insomniac.factor @@ -2,30 +2,25 @@ ! See http://factorcode.org/license.txt for BSD license. USING: logging.analysis logging.server logging smtp kernel 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 IN: logging.insomniac SYMBOL: insomniac-sender SYMBOL: insomniac-recipients -: ?analyze-log ( service word-names -- string/f ) - [ analyze-log-file ] with-string-writer ; - : email-subject ( service -- string ) [ "Log analysis for " % % " on " % io.sockets:host-name % ] "" make ; -: (email-log-report) ( service word-names -- ) - dupd ?analyze-log [ drop ] [ - - swap >>body - insomniac-recipients get >>to - insomniac-sender get >>from - swap email-subject >>subject - send-email - ] if-empty ; +:: (email-log-report) ( service word-names -- ) + + [ service word-names analyze-log-file ] with-string-writer >>body + insomniac-recipients get >>to + insomniac-sender get >>from + service email-subject >>subject + send-email ; \ (email-log-report) NOTICE add-error-logging