SYNOPSIS

 @Log::Agent::Channel::XXX::ISA = qw(Log::Agent::Channel);

DESCRIPTION

The \*(C`Log::Agent::Channel\*(C' class is the root class from which all \*(C`Log::Agent\*(C' channels inherit. It is a deferred class, meaning that it cannot be instantiated directly. All the deferred routines need to be implemented by its heirs to form a valid driver.

Internally, the various \*(C`Log::Agent::Driver\*(C' objects create \*(C`Log::Agent::Channel\*(C' instances for each logging channel defined at driver creation time. The channels are therefore architecturally hidden within \*(C`Log::Agent\*(C', since this module only provides redefined mappings for the various logxxx() routines (logerr(), logwarn(), logdie(), etc...).

However, this does not mean that channel classes cannot be used externally: the \*(C`Log::Agent::Logger\*(C' extension makes \*(C`Log::Agent::Channel\*(C' objects architecturally visible, thereby offering an application-level logging \s-1API\s0 that can be redirected to various places transparently for the application.

CHANNEL LIST

The following channels are currently made available by \*(C`Log::Agent\*(C'. More channels can be defined by the \*(C`Log::Agent::Logger\*(C' extension:

Log::Agent::Channel::File

This channel writes logs to files, defined by their path or via a magical opening sequence such as \*(L"|cmd\*(R". See Log::Agent::Channel::File.

Log::Agent::Channel::Handle

This channel writes logs to an already opened descriptor, as specified by its file handle: an IO::Handle object, or a \s-1GLOB\s0 reference such as \*FILE. See Log::Agent::Channel::Handle.

Log::Agent::Channel::Syslog

This channel redirects logs to the syslogd\|(8) daemon, which will then handle the dispatching to various logfiles, based on its own configuration. See Log::Agent::Channel::Syslog.

INTERFACE

You need not read this section if you're only using \*(C`Log::Agent\*(C'. However, if you wish to implement another channel, then this section might be of interest.

The following routines are deferred and therefore need to be defined by the heir: Emit the log entry held in $logstring, at priority $priority. A trailing \*(L"\n\*(R" is added to the $logstring, if needed (i.e. if the physical entity does not do it already, like syslog does). The $priority argument must be a valid syslog priority, i.e. one of the following strings: \*(L"emerg\*(R", \*(L"alert\*(R", \*(L"crit\*(R", \*(L"err\*(R", \*(L"warning\*(R", \*(L"notice\*(R", \*(L"info\*(R", \*(L"debug\*(R". The $logstring may not really be a plain string. It can actually be a Log::Agent::Message object with an overloaded stringification routine, so the illusion should be complete.

close

Close the channel.

make

This is the creation routine. Its signature varies for each channel, naturally.

AUTHOR

Raphael Manfredi <[email protected]>

RELATED TO Log::Agent::Channel…

Log::Agent::Channel::File\|(3), Log::Agent::Channel::Handle\|(3), Log::Agent::Channel::Syslog\|(3), Log::Agent::Logger\|(3).