summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm24
-rw-r--r--debian/changelog3
-rw-r--r--doc/ikiwiki.setup3
-rw-r--r--doc/usage.mdwn6
-rwxr-xr-xikiwiki.pl1
5 files changed, 33 insertions, 4 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 560647e06..4fc37110b 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -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 {
diff --git a/debian/changelog b/debian/changelog
index 2bf2665c7..7ed15dcb1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup
index bef858d5b..e14991299 100644
--- a/doc/ikiwiki.setup
+++ b/doc/ikiwiki.setup
@@ -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
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index 048072df6..e0c7800d5 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -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,
diff --git a/ikiwiki.pl b/ikiwiki.pl
index fd9300fba..c9b53a031 100755
--- a/ikiwiki.pl
+++ b/ikiwiki.pl
@@ -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},