Log::R...:Syslog(3pm)

πŸ’– Log::R...:Syslog(3pm) β€” User Contributed Perl Documentation πŸ’–

okay bestie, sit down, hydrate, because we're talking about Log::Report::Dispatcher::Syslog β€” the module that sends your messages to syslog. yes, that syslog. the big one. let's go ✨


🌸 NAME 🌸

Log::Report::Dispatcher::Syslog β€” send messages to syslog, bestie πŸ’Œ


πŸ¦‹ INHERITANCE πŸ¦‹

Log::Report::Dispatcher::Syslog
  is a Log::Report::Dispatcher

so it's giving "child of Log::Report::Dispatcher" energy. iconic lineage, no notes πŸ‘‘


✨ SYNOPSIS ✨

# add syslog dispatcher
dispatcher SYSLOG => 'syslog', accept => 'NOTICE-',
  format_reason => 'IGNORE',
  to_prio => [ 'ALERT-' => 'err' ];

# disable default dispatcher, when daemon
dispatcher close => 'default';

literally just two little blocks and you're set 🫢


πŸ’… DESCRIPTION πŸ’…

This dispatcher produces output to syslog, and it's built on top of the Sys::Syslog module β€” and listen, Sys::Syslog will NOT be automatically installed for you, because some systems have a whole problem with this dependency. so like, you gotta bring your own. no cap πŸ™ˆ

The REASON for a message often uses names which are quite similar to the log-levels used by syslog. However: they have a different purpose. The REASON is used by the programmer to indicate the cause of the message β€” whether it was able to handle a certain situation. The syslog levels, meanwhile, are there for the user's of the program (and with syslog that's usually the system administrators). It is not unusual to see a "normal" error or mistake as a very serious situation in a production environment. So, you may wish to translate any message above reason MISTAKE into a LOG_CRIT. the vibe check says: prod is not the time to be chill 😭

The default translation table is list below. You can change the mapping using new(to_prio). See example in SYNOPSIS. πŸ‘†

TRACE   => LOG_DEBUG    ERROR   => LOG_ERR
ASSERT  => LOG_DEBUG    FAULT   => LOG_ERR
INFO    => LOG_INFO     ALERT   => LOG_ALERT
NOTICE  => LOG_NOTICE   FAILURE => LOG_EMERG
WARNING => LOG_WARNING  PANIC   => LOG_CRIT
MISTAKE => LOG_WARNING

Extends "DESCRIPTION" in Log::Report::Dispatcher. ✨


🧚 METHODS 🧚

Extends "METHODS" in Log::Report::Dispatcher.

πŸŽ€ Constructors πŸŽ€

Extends "Constructors" in Log::Report::Dispatcher.

$class->new($type, $name, %options)

With syslog, people tend not to include the REASON of the message in the logs, because that is already used to determine the destination of the message. Improves base, see "Constructors" in Log::Report::Dispatcher.

here's the whole option table, every single one, we're not skipping a thing 🫑

-Option        --Defined in             --Default
accept          Log::Report::Dispatcher  depend on mode
charset                                  'utf8'
facility                                 'user'
flags                                    'pid,nowait'
format                                   <unchanged>
format_reason   Log::Report::Dispatcher  'IGNORE'
identity                                 <basename C<$0>>
include_domain                           false
locale          Log::Report::Dispatcher  <system locale>
logsocket                                undef
mode            Log::Report::Dispatcher  'NORMAL'
to_prio                                  []
  • accept => $reasons|\@reasons β€” yep, this one's from Log::Report::Dispatcher, and its default is depend on mode.
  • charset => $charset β€” translate the text-strings into the specified $charset, otherwise the sysadmin may get unreadable text. be kind to your sysadmin fr fr. default is 'utf8' ✨
  • facility => $facility β€” the possible values for this depend (a little) on the system. POSIX only defines "user", and "local0" up to "local7". default: 'user'.
  • flags => $flags β€” any combination of $flags as defined by Sys::Syslog, as comma-separated string. Examples for flags are: "pid", "ndelay", and "nowait". default: 'pid,nowait'.
  • format => CODE β€” [1.10] with a CODE reference you get your hands on the text before it gets sent to syslog. The three parameters are: the (translated) text, the related text domain object, and the message object. You may want to use context information from the latter. ✨ [1.19] After the three positional parameters, there may be a list of pairs (named parameters) with additional info. This may contain a "location" with an ARRAY of information produced by caller() about the origin of the exception. default: <unchanged>.
  • format_reason => 'UPPERCASE'|'LOWERCASE'|'UCFIRST'|'IGNORE'|CODE β€” from Log::Report::Dispatcher, default 'IGNORE'.
  • identity => $program β€” default is <basename C<$0>>.
  • include_domain => BOOLEAN β€” [1.00] include the text-domain of the message in each logged message. default: false.
  • locale => LOCALE β€” from Log::Report::Dispatcher, default is the system locale.
  • logsocket => 'unix'|'inet'|'stream'|HASH β€” if specified, the log socket type will be initialized to this before openlog() is called. If not specified, the system default is used. default: undef.
  • mode => 'NORMAL'|'VERBOSE'|'ASSERT'|'DEBUG'|0..3 β€” from Log::Report::Dispatcher, default 'NORMAL'.
  • to_prio => \@PAIRS β€” see reasonToPrio(). default: [].

πŸ‘‘ Attributes πŸ‘‘

Extends "Attributes" in Log::Report::Dispatcher.

  • $obj->format( [CODE] ) β€” returns the "CODE" ref which formats the syslog line.
  • $obj->isDisabled() β€” inherited, see "Attributes" in Log::Report::Dispatcher.
  • $obj->mode() β€” inherited, see "Attributes" in Log::Report::Dispatcher.
  • $obj->name() β€” inherited, see "Attributes" in Log::Report::Dispatcher.
  • $obj->needs( [$reason] ) β€” inherited, see "Attributes" in Log::Report::Dispatcher.
  • $obj->type() β€” inherited, see "Attributes" in Log::Report::Dispatcher.

πŸ“ Logging πŸ“

Extends "Logging" in Log::Report::Dispatcher.

  • $any->addSkipStack(@CODE) β€” inherited, see "Logging" in Log::Report::Dispatcher.
  • $obj->close() β€” inherited, see "Logging" in Log::Report::Dispatcher.
  • $any->collectLocation() β€” inherited, see "Logging" in Log::Report::Dispatcher.
  • $any->collectStack( [$maxdepth] ) β€” inherited, see "Logging" in Log::Report::Dispatcher.
  • $obj->log(\%options, $reason, $message, $domain) β€” inherited, see "Logging" in Log::Report::Dispatcher.
  • $obj->reasonToPrio($reason) β€” returns a level which is understood by syslog(3), based on a translation table. This can be changed with new(to_prio). πŸ”₯
  • $obj->skipStack() β€” inherited, see "Logging" in Log::Report::Dispatcher.
  • $any->stackTraceLine(%options) β€” inherited, see "Logging" in Log::Report::Dispatcher.
  • $obj->translate(\%options, $reason, $message) β€” inherited, see "Logging" in Log::Report::Dispatcher.

🌈 DETAILS 🌈

Extends "DETAILS" in Log::Report::Dispatcher.


πŸ’€ DIAGNOSTICS πŸ’€

  • Error: max one active syslog dispatcher, attempt for $new have $old Cast by new()
  • Error: syslog level '$level' not understood Cast by new()

πŸ”₯ SEE ALSO πŸ”₯

This module is part of Log-Report version 1.46, built on June 16, 2026. Website: http://perl.overmeer.net/CPAN/ 🌐


πŸ’œ LICENSE πŸ’œ

For contributors see file ChangeLog.

This software is copyright (c) 2007-2026 by Mark Overmeer.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page bestie, you ate it up πŸ’…πŸ«Ά source: perl v5.40.1, dated 2026-07-05, and yeah the footer says Log::R...:Syslog(3pm) β€” we got there, periodt 🌸✨

πŸ“¦ where this page comes from