MiniLogger.st
changeset 21614 a84ce930ffde
parent 21609 34d4dda50ad5
child 21626 e4578e01f37f
--- a/MiniLogger.st	Wed Mar 01 11:54:10 2017 +0100
+++ b/MiniLogger.st	Wed Mar 01 11:56:33 2017 +0100
@@ -545,7 +545,13 @@
         severityXlated := INFO.
     ].
 
-    severityXlated < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    (ThresholdPerClass isNil and:[ThresholdPerPackage isNil]) ifTrue:[
+        (Threshold > severityXlated) ifTrue:[ ^ self ].
+    ] ifFalse:[
+        ((self severityThresholdOf:originator) > severityXlated) ifTrue:[^ self ].  
+    ].
+    
     messageXlated := message value asString.
 
     "/ to avoid recursion, turn off logOnTranscript while logging
@@ -575,6 +581,7 @@
 
     "Created: / 14-09-2011 / 21:18:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 20-01-2015 / 18:40:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:15:46 / cg"
 !
 
 log: message severity: severity originator: originator
@@ -587,108 +594,153 @@
 !MiniLogger class methodsFor:'logging - utils'!
 
 debug: message
-    DEBUG < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > DEBUG) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: message severity: DEBUG originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:13 / cg"
 !
 
 debug: format with: arg1
-    DEBUG < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > DEBUG) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1) severity: DEBUG originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:19 / cg"
 !
 
 debug: format with: arg1 with: arg2
-    DEBUG < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > DEBUG) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1 with: arg2) severity: DEBUG originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:25 / cg"
 !
 
 debug: format with: arg1 with: arg2 with:arg3
-    DEBUG < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > DEBUG) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: DEBUG originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:28 / cg"
 !
 
 enter: message
-    ENTER < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > ENTER) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: message severity: ENTER originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:36 / cg"
 !
 
 enter: format with: arg1
-    ENTER < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > ENTER) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1) severity: ENTER originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:39 / cg"
 !
 
 enter: format with: arg1 with: arg2
-    ENTER < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > ENTER) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1 with: arg2) severity: ENTER originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:42 / cg"
 !
 
 enter: format with: arg1 with: arg2 with:arg3
-    ENTER < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > ENTER) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: ENTER originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:45 / cg"
 !
 
 error: message
-    ERROR < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > ERROR) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: message severity: ERROR originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:50 / cg"
 !
 
 error: format with: arg1
-    ERROR < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > ERROR) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1) severity: ERROR originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:56 / cg"
 !
 
 error: format with: arg1 with: arg2
-    ERROR < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > ERROR) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1 with: arg2) severity: ERROR originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:09:59 / cg"
 !
 
 error: format with: arg1 with: arg2 with:arg3
-    ERROR < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > ERROR) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: ERROR originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:10:03 / cg"
 !
 
 fatal: message
-    FATAL < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > FATAL) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: message severity: FATAL originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:10:08 / cg"
 !
 
 fatal: format with: arg1
-    FATAL < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > FATAL) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1) severity: FATAL originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:10:13 / cg"
 !
 
 fatal: format with: arg1 with: arg2
-    FATAL < Threshold ifTrue:[ ^ self ].
+    "/ a quick rejector to avoid overhead in deployed apps
+    ((Threshold > FATAL) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
+
     self log: (format bindWith: arg1 with: arg2) severity: FATAL originator: thisContext sender receiver
 
     "Modified: / 02-12-2014 / 10:54:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-03-2017 / 11:10:16 / cg"
 !
 
 fatal: format with: arg1 with: arg2 with:arg3