NAME

Log::Abstraction::Backend::Syslog - send messages to syslog

VERSION

0.40

DESCRIPTION

Built for the syslog key of a logger hash. The connection is opened (setlogsock() with the hash's other keys, then openlog()) for the first message, and the message sent with syslog() through a %s format, so % sequences in it are logged literally. The caller's hash is not changed: facility, level and format are taken out of a copy, and server renamed host.

openlog() and closelog() are process-wide, so the instances that have opened the connection are counted, and closelog() is called when the last one is destroyed.

For use by Log::Abstraction only; see Log::Abstraction::Backend.

METHODS

new

my $backend = Log::Abstraction::Backend::Syslog->new(
    syslog => \%syslog, level => $level, format => $format,
);

emit

$backend->emit($logger, $event);

retain_connection

Log::Abstraction::Backend::Syslog->retain_connection();

Counts another user of the open connection: a clone of a logger that has opened it.

release_connection

Log::Abstraction::Backend::Syslog->release_connection();

A logger that opened the connection is going away; calls closelog() if it was the last.

AUTHOR

Nigel Horne njh@nigelhorne.com

SEE ALSO

Log::Abstraction, Log::Abstraction::Backend

COPYRIGHT AND LICENSE

Copyright (C) 2025-2026 Nigel Horne

Usage is subject to the GPL2 licence terms. If you use it, please let me know.