[Glass] Can I plug a custom transcript proxy for one closure execution?

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Thu Aug 6 13:30:30 PDT 2015

Hi guys,

This is the situation... I have some kind of background jobs that are fired
from seaside and they fork their own gem. From this background jobs I can
easily watch the log of the gem etc. One example of this is for example,
"Code Update". Problem is that a simple Code Update via Metacello brings
hundreds of entries in the ObjectLog (each Transcript show: ). Same for my
own background jobs. And it's redundant for me to have them in both places,
the gem log AND the object log.

So..the code is:

TranscriptProxy class: show: anObject

| proxy |
*(ObjectLogEntry transcript: anObject printString object: anObject)
(proxy := self proxyTranscript) ~~ nil
ifTrue: [ proxy show: anObject ]
*ifFalse: [ GsFile gciLogServer: '--transcript--', anObject printString ].*

The second line is how the thing gets written in the ObjectLog and fifth
line is how in the gem log file.

So... is there a way I can hook and say... for this closure execution, bind
"Transcript" to this MarianoProxyTranscript (this class would only write to
gem log for example).  I could do:

*Smalltalk at: #Transcript put: MarianoProxyTranscript.*
*self executeCode*
*] ensure: [Smalltalk at: #Transcript put: TranscriptProxy.]*

But that will affect other users right? (assuming the execureCode would do
a commit at some point).

Once James said: "Here is one alternative to consider: When a method is
compiled you provide a SymbolList that identifies the globals visible to
the code being compiled."
Could I compile the closure with the binding specified for Transcript?

Thanks in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150806/50764b4f/attachment.html>

More information about the Glass mailing list