 : log-entry. ( entry -- )
     "====== " write
     {
-        [ first (timestamp>string) bl ]
-        [ second pprint bl ]
-        [ third write nl ]
-        [ fourth "\n" join print ]
+        [ date>> (timestamp>string) bl ]
+        [ level>> pprint bl ]
+        [ word-name>> write nl ]
+        [ message>> "\n" join print ]
     } cleave ;
 
 : errors. ( errors -- )

SYMBOL: message-histogram

: analyze-entry ( entry -- )
    dup second ERROR eq? [ dup errors get push ] when
    dup second CRITICAL eq? [ dup errors get push ] when
    1 over third word-histogram get at+
    dup third word-names get member? [
        1 over rest message-histogram get at+
    ] when
    drop ;


! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences namespaces words assocs logging sorting
prettyprint io io.styles io.files io.encodings.utf8
strings combinators accessors arrays
logging.server logging.parser calendar.format ;
IN: logging.analysis

