--- a/Context.st Fri May 17 15:09:32 2019 +0200
+++ b/Context.st Sat May 18 10:14:18 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1988 by Claus Gittinger
All Rights Reserved
@@ -517,6 +519,28 @@
^ 1
!
+logFacility
+ "the 'log facility';
+ this is used by the Logger both as a prefix to the log message,
+ and maybe (later) used to filter and/or control per-facility log thresholds.
+ The default here is to base the facility on the package:
+ if the class is anywhere in the base ST/X system, 'STX' is returned as facility.
+ Otherwise, the last component of the package name is returned."
+
+ |cls|
+
+ method isNil ifTrue:[^ '???'].
+ (cls := method mclass) isNil ifTrue:[^ 'DOIT'].
+ ^ cls logFacility
+
+ "
+ thisContext logFacility
+ thisContext sender logFacility
+ "
+
+ "Created: / 18-05-2019 / 10:12:21 / Claus Gittinger"
+!
+
message
^ Message selector:selector arguments:self args
@@ -538,36 +562,35 @@
method
"return the method for which the receiver was created.
Change with ST/X vsn 6:
- In older versions, the method was not stored in the context, but a lookup
- was simulated using selector and class.
- (which occasionally returned the wrong method - especially in the debugger,
- when the debugged method was changed).
- This has been changed - especially to support Jan's meta-object protocol.
- It is now stored in the context"
+ In older versions, the method was not stored in the context, but a lookup
+ was simulated using selector and class.
+ (which occasionally returned the wrong method - especially in the debugger,
+ when the debugged method was changed).
+ This has been changed - especially to support Jan's meta-object protocol.
+ It is now stored in the context"
|c sender sendersSelector m|
(method notNil and:[method isMethod]) ifTrue:[
- ^ method
+ ^ method
].
"mhmh - maybe I am a context for an unbound method (as generated by doIt);
look in the sender's context. Consider this a kludge.
- Future versions of ST/X's message lookup may store the method in
- the context.
+ Future versions of ST/X's message lookup may store the method in the context.
"
sender := self sender.
sender notNil ifTrue:[
- sendersSelector := sender selector.
- sendersSelector notNil ifTrue:[
- (sendersSelector startsWith:'valueWithReceiver:') ifTrue:[
- m := sender receiver.
- m isMethod ifTrue:[
- method := m.
- ^ m
- ]
- ]
- ]
+ sendersSelector := sender selector.
+ sendersSelector notNil ifTrue:[
+ (sendersSelector startsWith:'valueWithReceiver:') ifTrue:[
+ m := sender receiver.
+ m isMethod ifTrue:[
+ method := m.
+ ^ m
+ ]
+ ]
+ ]
].
c := self searchClass.
@@ -576,22 +599,23 @@
(added to avoid recursive errors in case of a broken sender chain)
"
c isBehavior ifFalse:[
- 'Context [error]: non class in searchClass' errorPrintCR.
- ' selector: ' errorPrint. selector errorPrint.
- ' receiver: ' errorPrint. receiver errorPrintCR.
- ^ nil
+ 'Context [error]: non class in searchClass' errorPrintCR.
+ ' selector: ' errorPrint. selector errorPrint.
+ ' receiver: ' errorPrint. receiver errorPrintCR.
+ ^ nil
].
c := c whichClassIncludesSelector:selector.
c notNil ifTrue:[
- method := c compiledMethodAt:selector.
- ^ method
+ method := c compiledMethodAt:selector.
+ ^ method
].
^ nil
"Modified: / 28-06-2011 / 20:23:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 20-07-2012 / 14:46:37 / cg"
+ "Modified (comment): / 18-05-2019 / 10:04:17 / Claus Gittinger"
!
methodClass