On 7/6/06, Gonçalo Marrafa <[EMAIL PROTECTED]> wrote:
>
> Hi there.
>
> Here's my problem: i want to log events from my app to the database. For
> each event i want to log the date/time of the event, the user (stored in
> the session) and the event itself (a string).
>
> I would like to be able to log events from within controllers (in normal
> actions) and from within models (in afterSave() callbacks). What would be
> the best way of accomplishing this? For controllers by bet would be to use
> a component but, for models, i can't figure out an elegant way of doing it
> (i can't access the component).

do you have to log to a DB? because there's a $this->log() method
available to all that writes out to  a log file.

alternatively, and there's a little bit of duplication here, create a
writeLog method in both your app_model and app_controller, then you
can use in both.

hth

jon

>
> Any ideas for a good way of doing this?
>
> Thanks in advance.
>
> --
> Gonçalo Marrafa <[EMAIL PROTECTED]>
>
> >
>


-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to