[aur-dev] [PATCH] Add a logging function and logging fixins through the code

Sebastian Nowicki sebnow at gmail.com
Wed Jul 1 13:42:53 EDT 2009


On Jul 1, 2009, at 7:36 PM, Callan Barrett wrote:

>
> On 02/07/2009, at 1:31 AM, Sebastian Nowicki wrote:
>
>>
>> Might be easier to just put the "if(LOGGING) {}" into the logit()  
>> function itself, assuming this is the desired behavior for all  
>> instances of logging.
>
> I feel like an idiot for not putting it there in the first place but  
> now that I think about it... if logging was turned off we would be  
> doing 2 hits to the DB for almost every single action needlessly if  
> the check was inside the function. So maybe it's not worth the  
> simplicity?

Ah, you mean the calls to username_from_sid() and pkgname_from_id()?  
If they are always called, you could put that in the function as well,  
and only pass in the parameters ($_COOKIE['AURSID'], $pid),  
respectively, etc.). Otherwise you have a good point.

The current interface for the logit function is better (more flexible)  
than with the above suggested changes though. I'd probably stick with  
the redundancy.


More information about the aur-dev mailing list