MiniLogger.st
changeset 21614 a84ce930ffde
parent 21609 34d4dda50ad5
child 21626 e4578e01f37f
equal deleted inserted replaced
21613:327dd2743f94 21614:a84ce930ffde
   543         self log:('no such severity (%1, called from %2), use one from predefined severities. Original message will be logged as INFO' bindWith:severityXlated with:caller) 
   543         self log:('no such severity (%1, called from %2), use one from predefined severities. Original message will be logged as INFO' bindWith:severityXlated with:caller) 
   544              severity: ERROR facility: 'STX' originator: self.
   544              severity: ERROR facility: 'STX' originator: self.
   545         severityXlated := INFO.
   545         severityXlated := INFO.
   546     ].
   546     ].
   547 
   547 
   548     severityXlated < Threshold ifTrue:[ ^ self ].
   548     "/ a quick rejector to avoid overhead in deployed apps
       
   549     (ThresholdPerClass isNil and:[ThresholdPerPackage isNil]) ifTrue:[
       
   550         (Threshold > severityXlated) ifTrue:[ ^ self ].
       
   551     ] ifFalse:[
       
   552         ((self severityThresholdOf:originator) > severityXlated) ifTrue:[^ self ].  
       
   553     ].
       
   554     
   549     messageXlated := message value asString.
   555     messageXlated := message value asString.
   550 
   556 
   551     "/ to avoid recursion, turn off logOnTranscript while logging
   557     "/ to avoid recursion, turn off logOnTranscript while logging
   552     "/ had this problem with RecursionLock, which wanted to issue a warning
   558     "/ had this problem with RecursionLock, which wanted to issue a warning
   553     "/ ("cleanup for dead process") from inside Transcript code.
   559     "/ ("cleanup for dead process") from inside Transcript code.
   573      Logger log:'test message' severity:123 facility: 'TEST'
   579      Logger log:'test message' severity:123 facility: 'TEST'
   574     "
   580     "
   575 
   581 
   576     "Created: / 14-09-2011 / 21:18:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   582     "Created: / 14-09-2011 / 21:18:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   577     "Modified: / 20-01-2015 / 18:40:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   583     "Modified: / 20-01-2015 / 18:40:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   584     "Modified: / 01-03-2017 / 11:15:46 / cg"
   578 !
   585 !
   579 
   586 
   580 log: message severity: severity originator: originator
   587 log: message severity: severity originator: originator
   581     self log: message severity: severity facility: (self facilityOf: originator) originator: originator
   588     self log: message severity: severity facility: (self facilityOf: originator) originator: originator
   582 
   589 
   585 ! !
   592 ! !
   586 
   593 
   587 !MiniLogger class methodsFor:'logging - utils'!
   594 !MiniLogger class methodsFor:'logging - utils'!
   588 
   595 
   589 debug: message
   596 debug: message
   590     DEBUG < Threshold ifTrue:[ ^ self ].
   597     "/ a quick rejector to avoid overhead in deployed apps
       
   598     ((Threshold > DEBUG) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   599 
   591     self log: message severity: DEBUG originator: thisContext sender receiver
   600     self log: message severity: DEBUG originator: thisContext sender receiver
   592 
   601 
   593     "Modified: / 02-12-2014 / 10:54:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   602     "Modified: / 02-12-2014 / 10:54:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   603     "Modified: / 01-03-2017 / 11:09:13 / cg"
   594 !
   604 !
   595 
   605 
   596 debug: format with: arg1
   606 debug: format with: arg1
   597     DEBUG < Threshold ifTrue:[ ^ self ].
   607     "/ a quick rejector to avoid overhead in deployed apps
       
   608     ((Threshold > DEBUG) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   609 
   598     self log: (format bindWith: arg1) severity: DEBUG originator: thisContext sender receiver
   610     self log: (format bindWith: arg1) severity: DEBUG originator: thisContext sender receiver
   599 
   611 
   600     "Modified: / 02-12-2014 / 10:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   612     "Modified: / 02-12-2014 / 10:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   613     "Modified: / 01-03-2017 / 11:09:19 / cg"
   601 !
   614 !
   602 
   615 
   603 debug: format with: arg1 with: arg2
   616 debug: format with: arg1 with: arg2
   604     DEBUG < Threshold ifTrue:[ ^ self ].
   617     "/ a quick rejector to avoid overhead in deployed apps
       
   618     ((Threshold > DEBUG) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   619 
   605     self log: (format bindWith: arg1 with: arg2) severity: DEBUG originator: thisContext sender receiver
   620     self log: (format bindWith: arg1 with: arg2) severity: DEBUG originator: thisContext sender receiver
   606 
   621 
   607     "Modified: / 02-12-2014 / 10:54:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   622     "Modified: / 02-12-2014 / 10:54:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   623     "Modified: / 01-03-2017 / 11:09:25 / cg"
   608 !
   624 !
   609 
   625 
   610 debug: format with: arg1 with: arg2 with:arg3
   626 debug: format with: arg1 with: arg2 with:arg3
   611     DEBUG < Threshold ifTrue:[ ^ self ].
   627     "/ a quick rejector to avoid overhead in deployed apps
       
   628     ((Threshold > DEBUG) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   629 
   612     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: DEBUG originator: thisContext sender receiver
   630     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: DEBUG originator: thisContext sender receiver
   613 
   631 
   614     "Modified: / 02-12-2014 / 10:54:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   632     "Modified: / 02-12-2014 / 10:54:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   633     "Modified: / 01-03-2017 / 11:09:28 / cg"
   615 !
   634 !
   616 
   635 
   617 enter: message
   636 enter: message
   618     ENTER < Threshold ifTrue:[ ^ self ].
   637     "/ a quick rejector to avoid overhead in deployed apps
       
   638     ((Threshold > ENTER) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   639 
   619     self log: message severity: ENTER originator: thisContext sender receiver
   640     self log: message severity: ENTER originator: thisContext sender receiver
   620 
   641 
   621     "Modified: / 02-12-2014 / 10:54:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   642     "Modified: / 02-12-2014 / 10:54:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   643     "Modified: / 01-03-2017 / 11:09:36 / cg"
   622 !
   644 !
   623 
   645 
   624 enter: format with: arg1
   646 enter: format with: arg1
   625     ENTER < Threshold ifTrue:[ ^ self ].
   647     "/ a quick rejector to avoid overhead in deployed apps
       
   648     ((Threshold > ENTER) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   649 
   626     self log: (format bindWith: arg1) severity: ENTER originator: thisContext sender receiver
   650     self log: (format bindWith: arg1) severity: ENTER originator: thisContext sender receiver
   627 
   651 
   628     "Modified: / 02-12-2014 / 10:54:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   652     "Modified: / 02-12-2014 / 10:54:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   653     "Modified: / 01-03-2017 / 11:09:39 / cg"
   629 !
   654 !
   630 
   655 
   631 enter: format with: arg1 with: arg2
   656 enter: format with: arg1 with: arg2
   632     ENTER < Threshold ifTrue:[ ^ self ].
   657     "/ a quick rejector to avoid overhead in deployed apps
       
   658     ((Threshold > ENTER) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   659 
   633     self log: (format bindWith: arg1 with: arg2) severity: ENTER originator: thisContext sender receiver
   660     self log: (format bindWith: arg1 with: arg2) severity: ENTER originator: thisContext sender receiver
   634 
   661 
   635     "Modified: / 02-12-2014 / 10:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   662     "Modified: / 02-12-2014 / 10:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   663     "Modified: / 01-03-2017 / 11:09:42 / cg"
   636 !
   664 !
   637 
   665 
   638 enter: format with: arg1 with: arg2 with:arg3
   666 enter: format with: arg1 with: arg2 with:arg3
   639     ENTER < Threshold ifTrue:[ ^ self ].
   667     "/ a quick rejector to avoid overhead in deployed apps
       
   668     ((Threshold > ENTER) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   669 
   640     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: ENTER originator: thisContext sender receiver
   670     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: ENTER originator: thisContext sender receiver
   641 
   671 
   642     "Modified: / 02-12-2014 / 10:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   672     "Modified: / 02-12-2014 / 10:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   673     "Modified: / 01-03-2017 / 11:09:45 / cg"
   643 !
   674 !
   644 
   675 
   645 error: message
   676 error: message
   646     ERROR < Threshold ifTrue:[ ^ self ].
   677     "/ a quick rejector to avoid overhead in deployed apps
       
   678     ((Threshold > ERROR) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   679 
   647     self log: message severity: ERROR originator: thisContext sender receiver
   680     self log: message severity: ERROR originator: thisContext sender receiver
   648 
   681 
   649     "Modified: / 02-12-2014 / 10:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   682     "Modified: / 02-12-2014 / 10:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   683     "Modified: / 01-03-2017 / 11:09:50 / cg"
   650 !
   684 !
   651 
   685 
   652 error: format with: arg1
   686 error: format with: arg1
   653     ERROR < Threshold ifTrue:[ ^ self ].
   687     "/ a quick rejector to avoid overhead in deployed apps
       
   688     ((Threshold > ERROR) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   689 
   654     self log: (format bindWith: arg1) severity: ERROR originator: thisContext sender receiver
   690     self log: (format bindWith: arg1) severity: ERROR originator: thisContext sender receiver
   655 
   691 
   656     "Modified: / 02-12-2014 / 10:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   692     "Modified: / 02-12-2014 / 10:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   693     "Modified: / 01-03-2017 / 11:09:56 / cg"
   657 !
   694 !
   658 
   695 
   659 error: format with: arg1 with: arg2
   696 error: format with: arg1 with: arg2
   660     ERROR < Threshold ifTrue:[ ^ self ].
   697     "/ a quick rejector to avoid overhead in deployed apps
       
   698     ((Threshold > ERROR) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   699 
   661     self log: (format bindWith: arg1 with: arg2) severity: ERROR originator: thisContext sender receiver
   700     self log: (format bindWith: arg1 with: arg2) severity: ERROR originator: thisContext sender receiver
   662 
   701 
   663     "Modified: / 02-12-2014 / 10:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   702     "Modified: / 02-12-2014 / 10:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   703     "Modified: / 01-03-2017 / 11:09:59 / cg"
   664 !
   704 !
   665 
   705 
   666 error: format with: arg1 with: arg2 with:arg3
   706 error: format with: arg1 with: arg2 with:arg3
   667     ERROR < Threshold ifTrue:[ ^ self ].
   707     "/ a quick rejector to avoid overhead in deployed apps
       
   708     ((Threshold > ERROR) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   709 
   668     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: ERROR originator: thisContext sender receiver
   710     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: ERROR originator: thisContext sender receiver
   669 
   711 
   670     "Modified: / 02-12-2014 / 10:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   712     "Modified: / 02-12-2014 / 10:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   713     "Modified: / 01-03-2017 / 11:10:03 / cg"
   671 !
   714 !
   672 
   715 
   673 fatal: message
   716 fatal: message
   674     FATAL < Threshold ifTrue:[ ^ self ].
   717     "/ a quick rejector to avoid overhead in deployed apps
       
   718     ((Threshold > FATAL) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   719 
   675     self log: message severity: FATAL originator: thisContext sender receiver
   720     self log: message severity: FATAL originator: thisContext sender receiver
   676 
   721 
   677     "Modified: / 02-12-2014 / 10:54:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   722     "Modified: / 02-12-2014 / 10:54:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   723     "Modified: / 01-03-2017 / 11:10:08 / cg"
   678 !
   724 !
   679 
   725 
   680 fatal: format with: arg1
   726 fatal: format with: arg1
   681     FATAL < Threshold ifTrue:[ ^ self ].
   727     "/ a quick rejector to avoid overhead in deployed apps
       
   728     ((Threshold > FATAL) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   729 
   682     self log: (format bindWith: arg1) severity: FATAL originator: thisContext sender receiver
   730     self log: (format bindWith: arg1) severity: FATAL originator: thisContext sender receiver
   683 
   731 
   684     "Modified: / 02-12-2014 / 10:54:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   732     "Modified: / 02-12-2014 / 10:54:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   733     "Modified: / 01-03-2017 / 11:10:13 / cg"
   685 !
   734 !
   686 
   735 
   687 fatal: format with: arg1 with: arg2
   736 fatal: format with: arg1 with: arg2
   688     FATAL < Threshold ifTrue:[ ^ self ].
   737     "/ a quick rejector to avoid overhead in deployed apps
       
   738     ((Threshold > FATAL) and:[ThresholdPerClass isNil and:[ThresholdPerPackage isNil]]) ifTrue:[ ^ self ].
       
   739 
   689     self log: (format bindWith: arg1 with: arg2) severity: FATAL originator: thisContext sender receiver
   740     self log: (format bindWith: arg1 with: arg2) severity: FATAL originator: thisContext sender receiver
   690 
   741 
   691     "Modified: / 02-12-2014 / 10:54:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   742     "Modified: / 02-12-2014 / 10:54:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   743     "Modified: / 01-03-2017 / 11:10:16 / cg"
   692 !
   744 !
   693 
   745 
   694 fatal: format with: arg1 with: arg2 with:arg3
   746 fatal: format with: arg1 with: arg2 with:arg3
   695     FATAL < Threshold ifTrue:[ ^ self ].
   747     FATAL < Threshold ifTrue:[ ^ self ].
   696     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: FATAL originator: thisContext sender receiver
   748     self log: (format bindWith: arg1 with: arg2 with:arg3) severity: FATAL originator: thisContext sender receiver