Log::Any::Adapter::Syslog - Send Log::Any logs to syslog
version 1.6
use Log::Any::Adapter; Log::Any::Adapter->set('Syslog'); # You can override defaults: use Unix::Syslog qw{:macros}; Log::Any::Adapter->set( 'Syslog', # name defaults to basename($0) name => 'my-name', # options default to LOG_PID options => LOG_PID|LOG_PERROR, # facility defaults to LOG_LOCAL7 facility => LOG_LOCAL7 );
Log::Any is a generic adapter for writing logging into Perl modules; this adapter use the Unix::Syslog module to direct that output into the standard Unix syslog system.
Log::Any::Adapter::Syslog is designed to work out of the box with no configuration required; the defaults should be reasonably sensible.
Log::Any::Adapter::Syslog
You can override the default configuration by passing extra arguments to the Log::Any::Adapter method:
Log::Any::Adapter
The name argument defaults to the basename of $0 if not supplied, and is inserted into each line sent to syslog to identify the source.
$0
The options configure the behaviour of syslog; see Unix::Syslog for details.
The default is LOG_PID, which includes the PID of the current process after the process name:
LOG_PID
example-process[2345]: something amazing!
The most likely addition to that is LOG_PERROR which causes syslog to also send a copy of all log messages to the controlling terminal of the process.
LOG_PERROR
WARNING: If you pass a defined value you are setting, not augmenting, the options. So, if you want LOG_PID as well as other flags, pass them all.
The facility determines where syslog sends your messages. The default is LOCAL7, which is not the most useful value ever, but is less bad than assuming the fixed facilities.
LOCAL7
See Unix::Syslog and syslog(3) for details on the available facilities.
Minimum syslog level. All messages below the selected level will be silently discarded. Default is debug.
If LOG_LEVEL environment variable is set, it will be used instead. If TRACE environment variable is set to true, level will be set to 'trace'. If DEBUG environment variable is set to true, level will be set to 'debug'. If VERBOSE environment variable is set to true, level will be set to 'info'.If QUIET environment variable is set to true, level will be set to 'error'.
Daniel Pittman <daniel@rimspace.net>
Stephen Thirlwall <sdt@cpan.org>
Maros Kollar <maros.kollar@geizhals.at>
This software is copyright (c) 2016 by Stephen Thirlwall.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Log::Any::Adapter::Syslog, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Any::Adapter::Syslog
CPAN shell
perl -MCPAN -e shell install Log::Any::Adapter::Syslog
For more information on module installation, please visit the detailed CPAN module installation guide.