* Add --syslog config option, to log to the syslog.

master
joey 2006-08-16 21:17:49 +00:00
parent 3357e70453
commit 24fcf2b97d
5 changed files with 33 additions and 4 deletions

View File

@ -21,6 +21,7 @@ sub defaultconfig () { #{{{
wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]*)\]\]/,
wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/,
verbose => 0,
syslog => 0,
wikiname => "wiki",
default_pageext => "mdwn",
cgi => 0,
@ -119,12 +120,31 @@ sub error ($) { #{{{
print "Content-type: text/html\n\n";
print misctemplate("Error", "<p>Error: @_</p>");
}
die @_;
log_message(error => @_);
exit(1);
} #}}}
sub debug ($) { #{{{
return unless $config{verbose};
if (! $config{cgi}) {
log_message(debug => @_);
} #}}}
my $log_open=0;
sub log_message ($$) { #{{{
my $type=shift;
if ($config{syslog}) {
require Sys::Syslog;
unless ($log_open) {
Sys::Syslog::setlogsock('unix');
Sys::Syslog::openlog('ikiwiki', '', 'user');
$log_open=1;
}
eval {
Sys::Syslog::syslog($type, join(" ", @_));
}
}
elsif (! $config{cgi}) {
print "@_\n";
}
else {

3
debian/changelog vendored
View File

@ -3,8 +3,9 @@ ikiwiki (1.20) UNRELEASED; urgency=low
* Relicense the templates and basewiki under the 2-clause BSD license.
Since these can easily become part of other people's websites, they
should be under as permissive a license as possible.
* Add --syslog config option, to log to the syslog.
-- Joey Hess <joeyh@debian.org> Wed, 16 Aug 2006 16:30:44 -0400
-- Joey Hess <joeyh@debian.org> Wed, 16 Aug 2006 17:07:35 -0400
ikiwiki (1.19) unstable; urgency=low

View File

@ -74,6 +74,9 @@ use IkiWiki::Setup::Standard {
#timeformat => '%c',
# Locale to use. Must be a UTF-8 locale.
#locale => 'en_US.UTF-8',
# Logging settings:
verbose => 0,
syslog => 0,
# To add plugins, list them here.
#add_plugins => [qw{meta tag pagecount brokenlinks search smiley

View File

@ -212,10 +212,14 @@ configuration options of their own.
Specify how to display the time or date. The format string is passed to the
strftime(3) function.
* --verbose
* --verbose, --no-verbose
Be vebose about what is being done.
* --syslog, --no-syslog
Log to syslog.
* --w3mmode, --no-w3mmode
Enable [[w3mmode]], which allows w3m to use ikiwiki as a local CGI script,

View File

@ -23,6 +23,7 @@ sub getconfig () { #{{{
"setup|s=s" => \$config{setup},
"wikiname=s" => \$config{wikiname},
"verbose|v!" => \$config{verbose},
"syslog!" => \$config{syslog},
"rebuild!" => \$config{rebuild},
"refresh!" => \$config{refresh},
"wrappers!" => \$config{wrappers},