[pacman-dev] [PATCH 0/4] [RFC] add caller prefix to	alpm_logaction
    Allan McRae 
    allan at archlinux.org
       
    Tue Jan  1 22:13:30 EST 2013
    
    
  
On 21/12/12 08:09, Andrew Gregory wrote:
> Implements the following TODO from alpm_logaction in log.c:
> 
>> TODO We should add a prefix to log strings depending on who called us.
>> If logaction was called by the frontend:
>>   USER: <the frontend log>
>> and if called internally:
>>   ALPM: <the library log>
>> Moreover, the frontend should be able to choose its prefix
>> (USER by default?):
>>   pacman: "PACMAN"
>>   kpacman: "KPACMAN"
>> This would allow us to share the log file between several frontends
>> and know who does what     
> 
> The log prefix can be added two different ways.  To make it easier for
> frontends, handle->program can be set to the program name (defaults to "USER")
> which will be used for calls to alpm_logaction.  The prefix can be set per call
> with alpm_plogaction; this is what alpm does.
> 
> Resulting logfile looks like this:
> 
>> [2012-12-20 16:29] [PACMAN] Running '/home/ag/devel/pacman/src/pacman/.libs/lt-pacman -Rdd pacman'
>> [2012-12-20 16:29] [ALPM] warning: /etc/pacman.conf saved as /etc/pacman.conf.pacsave
>> [2012-12-20 16:29] [PACMAN] removed pacman (4.0.3-5)
>> [2012-12-20 16:29] [PACMAN] Running '/home/ag/devel/pacman/src/pacman/.libs/lt-pacman --conf /etc/pacman.conf.pacsave -S pacman'
>> [2012-12-20 16:29] [ALPM-SCRIPTLET]  >>> Run  `pacman-key --init; pacman-key --populate archlinux`
>> [2012-12-20 16:29] [ALPM-SCRIPTLET]  >>> to import the data required by pacman for package verification.
>> [2012-12-20 16:29] [ALPM-SCRIPTLET]  >>> See: https://www.archlinux.org/news/having-pacman-verify-packages
>> [2012-12-20 16:29] [PACMAN] installed pacman (4.0.3-5)
That looks fine to me.   Not it will break paclog-pkglist, but should be
reasonably easy to fix...
However, I think there is too much going on here with the setting a
package name, creating a new function for use in libalpm, etc.   We are
never that attached to API around here, so I would just add a new
parameter to alpm_logaction and for everything to provide a caller.
Anyone else have an opinion on this?
Allan
    
    
More information about the pacman-dev
mailing list