[squeak-dev] squeak logging package(s)

Robert Withers robert.withers at pm.me
Fri Jul 10 19:44:04 UTC 2020


Hello,

> I would take this opportunity to point out the TraceMonitor [1] package in Cryptography.

> Installer ss project: "Cryptography'; install: 'TraceMonitor'.

The use is very straightforward as shown in the test case.

> TraceMonitorTestCase>>#testTraceMonitor

>> | monitor |
>> monitor := TraceMonitor newNick: 'TestingMonitor'.
>> monitor monitor: self.
>> self etrace: #info msg: '1'.
>> self etrace: #warn msg: '1'.
>> self etrace: #debug msg: '1'.
>> self etrace: #error msg: '1'.

There is additional API, such as TraceMonitor>>#traceToTranscript. The default enabled domains are set in

> TraceMonitor>>#initializeDefaultMonitors

>> self enableDomain: #info.
>> self enableDomain: #warning.
>> self enableDomain: #error.
>> self enableDomain: #debug.

You can always add new domains, such as #over_the_wire or #engine or #obj_references or what ever you need for your project. Then you can throw an event for that new domain with:

>> self etrace: #over_the_wire msg: 'msg received'.self etrace: #engine msg: 'Engine state changed'.
>> self etrace: #obj_references msg: 'new object registered'.

Another aspect is that the monitoring of internal objects can be granted by an previously registered object. So let us say you are monitoring the engine and it wants to extend monitoring to the object tables. First, you would #monitor: the engine:

> | engine monitor |
> monitor := TraceMonitor newNick: 'TestingMonitor'. engine := SampleEngine new.
> monitor monitor: engine.
> engine init.

Then in SampleEngine>>#init we register the Object Tables, called the Scope.

> SampleEngine>>#init
> objectTables := Scope new.
> self monitor: objectTables.

>>

Thus, when inside a Scope method, calls #etrace:msg: the TraceMonitor will post it.

> self etrace: #obj_references msg: 'new object registered'.

I hope this helps you to understand its uses. I hope you find it useful!

>>

Kindly,
rabbit

[1] TraceMonitor - http://www.squeaksource.com/@fLap-whI8O1pUZtu/eNY6xSnW (this link may soon expire)

On 7/10/20 3:08 PM, Jakob Reschke wrote:

> VA Smalltalk has log4s as a Smalltalk port of log4j. But I guess it is proprietary because you buy it with VA Smalltalk.
>
> Davide Grandi <davide.grandi at email.it> schrieb am Fr., 10. Juli 2020, 12:57:
>
>> slicing a small slice of log4* ?
>> *doc => all classes : not too many classes.
>>
>> "they" stole sUnit ... so we can slice log4*.
>>
>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/index.html
>>
>> (sorry, just my 0,02€)
>>
>> Cheers,
>>
>> Davide
>>
>> On 10/07/2020 02:13, tim Rowledge wrote:
>>> I'm looking for some good message logging stuff - something a little more flexible that `Transcript show:` level - and so far the best I can see is a rather old package on squeaksource named 'Logging' originally by Keith Hodges but with quite a few updates by Mat Fulmer.
>>>
>>> I wonder if anyone is using it in a current image? It seems to rely on some process specific variable code that *looks* like has been incorporated into the trunk. I don't want to spend too much time peering at it is somebody else already knows whether it is unusable now or better yet still 'load and go'
>>>
>>> Or indeed, it somebody has a pointer to sometihng newer/better/shinier?
>>>
>>> tim
>>> --
>>> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>>> Ubi dubium ibi libertas
>>
>> --
>> Ing. Davide Grandi
>> email : davide.grandi at email.it
>> mobile : +39 339 7468 778
>> linkedin : http://linkedin.com/in/davidegrandi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200710/e00ec8fd/attachment.html>


More information about the Squeak-dev mailing list