! See http://factorcode.org/license.txt for BSD license.\r
USING: logging.analysis logging.server logging smtp kernel\r
io.files io.streams.string namespaces make timers assocs\r
-io.encodings.utf8 accessors calendar sequences ;\r
+io.encodings.utf8 accessors calendar sequences locals ;\r
QUALIFIED: io.sockets\r
IN: logging.insomniac\r
\r
SYMBOL: insomniac-sender\r
SYMBOL: insomniac-recipients\r
\r
-: ?analyze-log ( service word-names -- string/f )\r
- [ analyze-log-file ] with-string-writer ;\r
-\r
: email-subject ( service -- string )\r
[\r
"Log analysis for " % % " on " % io.sockets:host-name %\r
] "" make ;\r
\r
-: (email-log-report) ( service word-names -- )\r
- dupd ?analyze-log [ drop ] [\r
- <email>\r
- swap >>body\r
- insomniac-recipients get >>to\r
- insomniac-sender get >>from\r
- swap email-subject >>subject\r
- send-email\r
- ] if-empty ;\r
+:: (email-log-report) ( service word-names -- )\r
+ <email>\r
+ [ service word-names analyze-log-file ] with-string-writer >>body\r
+ insomniac-recipients get >>to\r
+ insomniac-sender get >>from\r
+ service email-subject >>subject\r
+ send-email ;\r
\r
\ (email-log-report) NOTICE add-error-logging\r
\r