From 768c54c0c1e04f316e9d28cf1c9ac60da610da1c Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 12 Jan 2014 12:16:19 +0000 Subject: [PATCH] Support called-defined prefix. --- Webperl/Logger.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Webperl/Logger.pm b/Webperl/Logger.pm index 0793fb3..0762fb0 100644 --- a/Webperl/Logger.pm +++ b/Webperl/Logger.pm @@ -60,7 +60,8 @@ BEGIN { # Defaults to false. # logname - If set, messages sent to warn_log and die_log will be appended # to the specified log file. See start_log below for more details. -# syslog - If set to true, messages are copied into syslog. +# syslog - If set then messages are written to syslog prefixed with this +# string. # # @param args A hash of key, value pairs with which to initialise the object. # @return A new Logging object. @@ -82,7 +83,7 @@ sub new { # Set up syslog if needed. If open fails, disable syslog again if($obj -> {"syslog"}) { - eval { openlog($$, "ndelay,pid", LOG_DAEMON); }; + eval { openlog($obj -> {"syslog"}, "ndelay,pid", LOG_DAEMON); }; if($@) { $obj -> {"syslog"} = 0; $obj -> warn_log(undef, "Unable to conenct to syslog: $@");