Fix analysis for recent change
							parent
							
								
									294c301877
								
							
						
					
					
						commit
						095a3e984c
					
				| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
! 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 io.files io.encodings.utf8
 | 
					prettyprint io io.styles io.files io.encodings.utf8
 | 
				
			||||||
strings combinators
 | 
					strings combinators accessors arrays
 | 
				
			||||||
logging.server logging.parser calendar.format ;
 | 
					logging.server logging.parser calendar.format ;
 | 
				
			||||||
IN: logging.analysis
 | 
					IN: logging.analysis
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,11 +12,11 @@ SYMBOL: word-histogram
 | 
				
			||||||
SYMBOL: message-histogram
 | 
					SYMBOL: message-histogram
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: analyze-entry ( entry -- )
 | 
					: analyze-entry ( entry -- )
 | 
				
			||||||
    dup second ERROR eq? [ dup errors get push ] when
 | 
					    dup level>> { ERROR CRITICAL } memq? [ dup errors get push ] when
 | 
				
			||||||
    dup second CRITICAL eq? [ dup errors get push ] when
 | 
					    1 over word-name>> word-histogram get at+
 | 
				
			||||||
    1 over third word-histogram get at+
 | 
					    dup word-name>> word-names get member? [
 | 
				
			||||||
    dup third word-names get member? [
 | 
					        1 over [ level>> ] [ word-name>> ] [ message>> ] tri 3array
 | 
				
			||||||
        1 over rest message-histogram get at+
 | 
					        message-histogram get at+
 | 
				
			||||||
    ] when
 | 
					    ] when
 | 
				
			||||||
    drop ;
 | 
					    drop ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,10 +46,10 @@ SYMBOL: message-histogram
 | 
				
			||||||
: log-entry. ( entry -- )
 | 
					: log-entry. ( entry -- )
 | 
				
			||||||
    "====== " write
 | 
					    "====== " write
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        [ first (timestamp>string) bl ]
 | 
					        [ date>> (timestamp>string) bl ]
 | 
				
			||||||
        [ second pprint bl ]
 | 
					        [ level>> pprint bl ]
 | 
				
			||||||
        [ third write nl ]
 | 
					        [ word-name>> write nl ]
 | 
				
			||||||
        [ fourth "\n" join print ]
 | 
					        [ message>> "\n" join print ]
 | 
				
			||||||
    } cleave ;
 | 
					    } cleave ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: errors. ( errors -- )
 | 
					: errors. ( errors -- )
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ SYMBOL: message-histogram
 | 
				
			||||||
    "==== INTERESTING MESSAGES:" print nl
 | 
					    "==== INTERESTING MESSAGES:" print nl
 | 
				
			||||||
    "Total: " write dup values sum . nl
 | 
					    "Total: " write dup values sum . nl
 | 
				
			||||||
    [
 | 
					    [
 | 
				
			||||||
        dup second write ": " write third "\n" join write
 | 
					        dup level>> write ": " write message>> "\n" join write
 | 
				
			||||||
    ] histogram.
 | 
					    ] histogram.
 | 
				
			||||||
    nl
 | 
					    nl
 | 
				
			||||||
    "==== WORDS:" print nl
 | 
					    "==== WORDS:" print nl
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue