Fixing logging

db4
Slava Pestov 2008-03-07 17:20:15 -06:00
parent c6c7269d45
commit 71a1edf426
2 changed files with 14 additions and 13 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences namespaces words assocs logging sorting USING: kernel sequences namespaces words assocs logging sorting
prettyprint io io.styles strings logging.parser ; prettyprint io io.styles strings logging.parser calendar.format ;
IN: logging.analysis IN: logging.analysis
SYMBOL: word-names SYMBOL: word-names
@ -42,16 +42,14 @@ SYMBOL: message-histogram
] tabular-output ; ] tabular-output ;
: log-entry. : log-entry.
[ "====== " write
dup first [ write ] with-cell dup first (timestamp>string) bl
dup second [ pprint ] with-cell dup second pprint bl
dup third [ write ] with-cell dup third write nl
fourth "\n" join [ write ] with-cell fourth "\n" join print ;
] with-row ;
: errors. ( errors -- ) : errors. ( errors -- )
standard-table-style [ log-entry. ] each ;
[ [ log-entry. ] each ] tabular-output ;
: analysis. ( errors word-histogram message-histogram -- ) : analysis. ( errors word-histogram message-histogram -- )
"==== INTERESTING MESSAGES:" print nl "==== INTERESTING MESSAGES:" print nl

View File

@ -1,8 +1,9 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! 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 io.sockets USING: logging.analysis logging.server logging smtp kernel
kernel io.files io.streams.string namespaces alarms assocs io.files io.streams.string namespaces alarms assocs
io.encodings.utf8 accessors calendar ; io.encodings.utf8 accessors calendar qualified ;
QUALIFIED: io.sockets
IN: logging.insomniac IN: logging.insomniac
SYMBOL: insomniac-smtp-host SYMBOL: insomniac-smtp-host
@ -25,7 +26,9 @@ SYMBOL: insomniac-recipients
] with-scope ; inline ] with-scope ; inline
: email-subject ( service -- string ) : email-subject ( service -- string )
[ "[INSOMNIAC] " % % " on " % host-name % ] "" make ; [
"[INSOMNIAC] " % % " on " % io.sockets:host-name %
] "" make ;
: (email-log-report) ( service word-names -- ) : (email-log-report) ( service word-names -- )
[ [