 : 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 ;


    "==== INTERESTING MESSAGES:" print nl
    "Total: " write dup values sum . nl
    [
        dup level>> write ": " write message>> "\n" join write
    ] histogram.
    nl
    "==== WORDS:" print nl
