[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg-logger



>> "WA" == Wichert Akkerman <wakkerma@cs.leidenuniv.nl> writes:

WA> [1  <multipart/mixed>]
WA> [1.1  <text/plain; us-ascii (quoted-printable)>]
WA> Previously Ben Collins wrote:
>> Well, this is my first shot at making a wrapper for logger for packages
>> to use. This is just for testing and usability try outs. I used
>> dpkg-divert as a template so that it could easily be droped into
>> dpkg-?.?.?/scripts/ for actual usage.

WA> I made a slight rewrite to remove some code duplication. 

Two additions:

1. Perl has an way to acces the logsystem without logger. use
Sys::Syslog. This will save one exec, thous makeing the thing faster.

2. No need to call it with the package name. 

$ppid = getppid;
open IN, "/proc/$ppid/cmdline";
$line = <IN>;
close IN;

($package) = $line =~ m!/var/lib/dpkg/info/([^.]+)!;

This will give you the packagename as $package.

WA> I'm not sure if we should directly use the level that syslog uses
WA> here. We might want to define our own list and map that to syslog
WA> levels, so we can change how we handle them at a later time.

What kind of list do you think about ?

Ciao,
	Martin


Reply to: