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

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Fri Aug 7 13:09:15 PDT 2015


I think what I need is impossible to do...

btw...* there is no way I can add a symbol dictionary to the symbolList of
the current user but only for the scope of the running gem?*
I know if I don't commit my changes will be only for current session. But
my background processes DO commit and so they would also commit this
change.




On Thu, Aug 6, 2015 at 5:30 PM, Mariano Martinez Peck <marianopeck at gmail.com
> wrote:

> 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)
> addToLog.*
> (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,
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150807/7cc5e6ec/attachment.html>


More information about the Glass mailing list