[Seaside] Seaside Access/Activity Logging

Sven Van Caekenberghe sven at beta9.be
Tue Aug 24 11:48:32 UTC 2010


Hi Bart,

Thanks for the detailed explanation. 
I'll need some time to digest all this.
As I said in this thread: I am not yet sure what I am looking for, I was more thinking aloud.
Your approach sure sounds interesting.

Sven

On 24 Aug 2010, at 12:43, Bart Gauquie wrote:

> Hi Sven,
> 
> You don't have to to each callback manually. It goes automatically. Let me try to explain a bit.
> NotificationsAreaDecoration is a decoration you put around your root component.
> NotificationsAreaDecoration>>renderContentOn: html
> 	(self shouldRenderNotificationArea)
> 		ifTrue: [self renderNotificationAreaOn: html].
> 	[self next renderUndecoratedWithContext: 
> 		(NARenderContextDecorator decorated: html context using: self)]
> 	on: NotificationsAreaDecorationRequest
> 	do: [:aNotificationRequest|aNotificationRequest resume: self].
> 
> with:
> 	[self next renderUndecoratedWithContext: 
> 		(NARenderContextDecorator decorated: html context using: self)]
> 
> starts decorating the html context (which will be used further for each rendering object in the component tree) with NARenderContextDecorator
> 
> This one delegates all methods except:
> NARenderContextDecorator>>callbacks
> 	^NACallbackRegistryDecorator decorated: decorated callbacks using: notificationsAreaDecoration.	
> which in turn decorates NACallbackRegistryDecorator, and then
> NACallbackRegistryDecorator>>store: aCallback
> 	^decorated store: (NACallbackDecorator decorated: aCallback using: notificationsAreaDecoration)
> which gives you: 
> NACallbackDecorator>>evaluateWithFieldValues: anOrderedCollection
> 	^[notificationsAreaDecoration evaluateCapturingNotificationsOrErrors: 
> 		[decorated evaluateWithFieldValues: anOrderedCollection]]
> 	  on: NotificationsAreaDecorationRequest
> 	  do: [:request|request resume: notificationsAreaDecoration]
> 
> this evaluateWithFieldValues: will be called during a callback 
> now I'm using it to capture errors during callback and continue. 
> You could log each callback ... instead of my code.
> 
> I'm planning to extract this decorated thing into a separate package, but did not find the time for it yet.
> This notificationsArea is in use on: 
> BkbagGemstoneTesting:
> BkbagGemstoneTesting-Presentation>>AnimalRoot>>initialize
> 	super initialize.
> 	animalOverview := AnimalOverview new.
> 	self addDecoration: 
> 		(NotificationsAreaDecoration new
> 			captureErrorOfType: MAValidationError;
> 			yourself)
> 
> and in SunnysidePlanning2:
> SunnysidePlanning2-View-Root>>SunnysidePlanning2WorkAreaView>>initialize
> 	super initialize.
> 	self addDecoration: 
> 		(NotificationsAreaDecoration new
> 			captureNotificationOfType: SP2Notification;
> 			captureErrorOfType: SP2Error;
> 			errorInnerDivClass: 'error';
> 			notificationInnerDivClass: 'success';
> 			shouldRenderNotificationArea: false;
> 			notificationAreaDivClass: 'span-18 last';
> 			yourself).
> 	self session announcer
> 		when: SetAsMainView
> 		do: [:ann | root := ann component].
> 	root := KiesProductBacklogTask new.
> 
> 
> Hope this makes it somewhat clearer.
> 
> Kind Regards,
> Bart
> On Tue, Aug 24, 2010 at 12:10 PM, Sven Van Caekenberghe <sven at beta9.be> wrote:
> Hi Bart,
> 
> I am trying to understand your code but I am having some trouble finding my way ;-)
> Anyway, is "decorating your callbacks" a manual process that you have to do for each callbaclk ?
> If so, that would not really solve my problem...
> 
> Thx for the reply!
> 
> Sven
> 
> On 24 Aug 2010, at 08:13, Bart Gauquie wrote:
> 
> > Hi,
> >
> > What I've already 'hacked' in seaside is decorating all callbacks that can happen.
> > I've used the decorating to capture all errors during callbacks and collect them and show them on a notificationarea.
> > my code is at: http://www.squeaksource.com/NotificationsArea
> >
> > Maybe you can use the same trick to log all callbacks?
> >
> > Kind Regards,
> >
> > Bart
> >
> > On Mon, Aug 23, 2010 at 11:57 PM, Sven Van Caekenberghe <sven at beta9.be> wrote:
> > Hi All,
> >
> > In standard (non-heritic) web application frameworks, simple access logging is quite useful to find out how your app is used in the wild. The problem with Seaside is that most requests look pretty much the same and do not contain enough information for after the fact analysis (like http://localhost:8081/welcome?_s=0Sq2_xUpMPSWMOBg.R1&_k=DKeQJiyN2-ye2wCA doesn't say we're on the configuration page).
> >
> > Has anyone already 'solved' this 'problem' with some clever hack ? Maybe some filter in the right place with some reflection magic ?
> >
> > I guess manually inserting log statements (like augmenting the URL) would be one way...
> >
> > Thx,
> >
> > Sven
> >
> > _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> >
> > --
> > imagination is more important than knowledge - Albert Einstein
> > Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
> > Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
> > The true sign of intelligence is not knowledge but imagination. - Albert Einstein
> > However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
> > It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill
> > _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> 
> 
> -- 
> imagination is more important than knowledge - Albert Einstein
> Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
> Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
> The true sign of intelligence is not knowledge but imagination. - Albert Einstein
> However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
> It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list