Skip Menu |

This queue is for tickets about the Sys-Syslog CPAN distribution.

Report information
The Basics
Id: 19085
Status: resolved
Priority: 0/
Queue: Sys-Syslog

People
Owner: SAPER [...] cpan.org
Requestors: bryan.thale [...] motorola.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.13
Fixed in: 0.14



Subject: LOG_* level values aren't bitmasks
This could simply be my own misunderstanding of Sys::Syslog, but aren't the values for LOG_EMERG, LOG_CRIT, LOG_ERR, etc. supposed to be bit-wise OR-able to create the log mask as in setlogmask(LOG_CRIT|LOG_ERR|LOG_WARNING); But the values are simply a sequence from 0 to 7 with LOG_EMERG = 0 and LOG_DEBUG = 7. I'm using Sys::Syslog 0.13 on Fedora Core 3 with Perl 5.8.5.
Subject: Re: [rt.cpan.org #19085] LOG_* level values aren't bitmasks
Date: Mon, 8 May 2006 01:17:10 +0200
To: bug-Sys-Syslog [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Show quoted text
> This could simply be my own misunderstanding of Sys::Syslog, but aren't > the values for LOG_EMERG, LOG_CRIT, LOG_ERR, etc. supposed to be > bit-wise OR-able to create the log mask as in > > setlogmask(LOG_CRIT|LOG_ERR|LOG_WARNING); > > But the values are simply a sequence from 0 to 7 with LOG_EMERG = 0 and > LOG_DEBUG = 7.
In fact, after searching for and reading more detailed documentation, it appears that this example I added in Sys::Syslog documentation is wrong; it should be written: setlogmask( LOG_MASK(LOG_CRIT) | LOG_MASK(LOG_ERR) ); I am fixing the documentation and adding LOG_MASK() to the export list so it is available for Perl programmers. Thanks for reporting this bug. Sébastien Aperghis-Tramoni -- - --- -- - -- - --- -- - --- -- - --[ http://maddingue.org ] Close the world, txEn eht nepO
Subject: Re: [rt.cpan.org #19085] LOG_* level values aren't bitmasks
Date: Mon, 08 May 2006 09:01:56 -0500
To: bug-Sys-Syslog [...] rt.cpan.org
From: Bryan Thale <bryan.thale [...] motorola.com>
Speaking of documentation and the export list, I seem to have to "use Sys::Syslog qw(:DEFAULT :macros);" in order to get things to compile under "use strict". Is that intentional? From reading the documentation, I got the impression I should be ale to simply say "use Sys::Syslog;" to import everything I need for normal use of the package. Regards, Bryan. -- Bryan Thale Motorola Open Source Technologies, Mobile Devices bryan.thale@motorola.com
Subject: Re: [rt.cpan.org #19085] LOG_* level values aren't bitmasks
Date: Mon, 8 May 2006 17:24:17 +0200
To: bug-Sys-Syslog [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Show quoted text
> Speaking of documentation and the export list, I seem to have to "use > Sys::Syslog qw(:DEFAULT :macros);" in order to get things to compile > under "use strict". Is that intentional? From reading the > documentation, I got the impression I should be ale to simply say "use > Sys::Syslog;" to import everything I need for normal use of the > package.
That's intentional because Sys::Syslog didn't export the LOG_* macros before version 0.11. As these "macros" really are Perl functions, exporting them cost memory. Therefore they are not exported by default, in order to stay consistent with older versions. Also, using these macros is not needed in most cases as the openlog() and syslog() functions both accept strings and numeric macros. setlogmask() is the only function that only accepts numeric macros. Therefore if you want to write a program that uses the numeric macros in a sane way, you'll indeed need to use Sys::Syslog qw(:standard :macros); and probably add a dependency on version 0.11 of Sys::Syslog. To be perfectly complete, it was previously possible to use the macros, but only by fully naming them, hence leading to this horrible syntax: setlogmask( Sys::Syslog::LOG_UPTO(SYS::Syslog::LOG_DEBUG) ); That's probably the reason why so few modules on the CPAN use setlogmask(). Sébastien Aperghis-Tramoni -- - --- -- - -- - --- -- - --- -- - --[ http://maddingue.org ] Close the world, txEn eht nepO
Subject: Re: [rt.cpan.org #19085] LOG_* level values aren't bitmasks
Date: Mon, 08 May 2006 10:57:50 -0500
To: bug-Sys-Syslog [...] rt.cpan.org
From: Bryan Thale <bryan.thale [...] motorola.com>
Ok. That would probably be something worth mentioning in the documentation for setlogmask() the next time you're in there updating it. Thanks, Bryan. -- Bryan Thale Motorola Open Source Technologies, Mobile Devices bryan.thale@motorola.com