[cvsnt] loginfo example
bwhicks at aep.com
bwhicks at aep.com
Wed Nov 16 15:21:13 GMT 2005
I'm posting this because I've had a couple of people ask me about it.
Because of some strange problems with loginfo (tested in version
2.5.02.2099 and 2.5.02.2115), I couldn't pass the arguments directly as
space separated variables (like this: fix_loginfo.pl %s %V %v) and had to
pass them like this: %{sVv} which comma separates them. So, my loginfo file
looks like this:
DEFAULT fix_loginfo.pl %{sVv},$CVSROOT,$USER
and the fix_loginfo.pl script will send messages to syslog. it looks like
this:
#!/usr/bin/perl -w
use strict;
use warnings;
use Sys::Syslog;
my $output;
my @newARGV = split (/\,/,"@ARGV");
if ($newARGV[0] =~ /(\w+)\/+(\w+) \- New directory\s*/ ) {
$output = "A new directory called ".$2." was created in
".$newARGV[3]."/".$1." by user ".$newARGV[4];
} else {
$output = $newARGV[4]." has changed file
'".$newARGV[3]."/".$newARGV[0]."' from version ".$newARGV[1]." to version
".$newARGV[2];
}
openlog ('cvsnt','cons,pid','local3');
syslog ('info', $output);
closelog;
More information about the cvsnt
mailing list