1 ! Copyright (C) 2008, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors calendar io.streams.string kernel logging
4 logging.analysis make namespaces smtp timers ;
8 SYMBOL: insomniac-sender
9 SYMBOL: insomniac-recipients
11 : email-subject ( service -- string )
13 "Log analysis for " % % " on " % io.sockets:host-name %
16 :: (email-log-report) ( service word-names -- )
18 [ service word-names analyze-log-file ] with-string-writer >>body
19 insomniac-recipients get >>to
20 insomniac-sender get >>from
21 service email-subject >>subject
24 \ (email-log-report) NOTICE add-error-logging
26 : email-log-report ( service word-names -- )
27 "logging.insomniac" [ (email-log-report) ] with-logging ;
29 : schedule-insomniac ( service word-names -- )
30 [ email-log-report rotate-logs ] 2curry