summaryrefslogtreecommitdiffstats
path: root/urpm/msg.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-02-08 14:13:01 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-02-08 14:13:01 +0000
commit510a3116efe17e4bfb5a9243a6611cbad52ffe73 (patch)
treea1e59410a5e7dd7b803d94c0816225dd32fd1bae /urpm/msg.pm
parenteb57d050566ca0cb78d267ef494b95dbcca05109 (diff)
downloadurpmi-510a3116efe17e4bfb5a9243a6611cbad52ffe73.tar
urpmi-510a3116efe17e4bfb5a9243a6611cbad52ffe73.tar.gz
urpmi-510a3116efe17e4bfb5a9243a6611cbad52ffe73.tar.bz2
urpmi-510a3116efe17e4bfb5a9243a6611cbad52ffe73.tar.xz
urpmi-510a3116efe17e4bfb5a9243a6611cbad52ffe73.zip
Remove default logging to /var/log/urpmi.log.
Add an interface to syslog in urpm::msg. Make --env verify if env dir exists.
Diffstat (limited to 'urpm/msg.pm')
-rw-r--r--urpm/msg.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/urpm/msg.pm b/urpm/msg.pm
index 18053e13..5d633ace 100644
--- a/urpm/msg.pm
+++ b/urpm/msg.pm
@@ -7,7 +7,7 @@ use Exporter;
(our $VERSION) = q$Id$ =~ /(\d+\.\d+)/;
our @ISA = 'Exporter';
-our @EXPORT = qw(N log_it to_utf8 message_input message toMb from_utf8);
+our @EXPORT = qw(N bug_log to_utf8 message_input message toMb from_utf8 sys_log);
#- I18N.
use Locale::gettext;
@@ -46,8 +46,18 @@ sub N {
my $noexpr = N("Nn");
my $yesexpr = N("Yy");
+eval {
+ require Sys::Syslog;
+ Sys::Syslog->import();
+ (my $tool = $0) =~ s!.*/!!;
+ openlog($tool, '', 'user');
+ END { closelog() }
+};
+
+sub sys_log { defined &syslog and syslog("info", @_) }
+
#- writes only to logfile, not to screen
-sub log_it {
+sub bug_log {
if ($::logfile) {
open my $fh, ">>$::logfile"
or die "Can't output to log file [$::logfile]: $!\n";
@@ -68,13 +78,13 @@ sub message_input {
print ::SAVEOUT $msg;
}
if ($default_input) {
- $urpm::args::options{bug} and log_it($default_input);
+ $urpm::args::options{bug} and bug_log($default_input);
return $default_input;
}
$input = <STDIN>;
defined $input or return undef;
chomp $input;
- $urpm::args::options{bug} and log_it($input);
+ $urpm::args::options{bug} and bug_log($input);
if ($opts{boolean}) {
$input =~ /^[$noexpr$yesexpr]?$/ and last;
} elsif ($opts{range}) {