1Agent::Channel(3) User Contributed Perl Documentation Agent::Channel(3)
2
3
4
6 Log::Agent::Channel - ancestor class for all Log::Agent channels
7
9 @Log::Agent::Channel::XXX::ISA = qw(Log::Agent::Channel);
10
12 The "Log::Agent::Channel" class is the root class from which all
13 "Log::Agent" channels inherit. It is a deferred class, meaning that it
14 cannot be instantiated directly. All the deferred routines need to be
15 implemented by its heirs to form a valid driver.
16
17 Internally, the various "Log::Agent::Driver" objects create
18 "Log::Agent::Channel" instances for each logging channel defined at
19 driver creation time. The channels are therefore architecturally
20 hidden within "Log::Agent", since this module only provides redefined
21 mappings for the various logxxx() routines (logerr(), logwarn(),
22 logdie(), etc...).
23
24 However, this does not mean that channel classes cannot be used
25 externally: the "Log::Agent::Logger" extension makes
26 "Log::Agent::Channel" objects architecturally visible, thereby offering
27 an application-level logging API that can be redirected to various
28 places transparently for the application.
29
31 The following channels are currently made available by "Log::Agent".
32 More channels can be defined by the "Log::Agent::Logger" extension:
33
34 Log::Agent::Channel::File
35 This channel writes logs to files, defined by their path or via a
36 magical opening sequence such as "|cmd". See
37 Log::Agent::Channel::File.
38
39 Log::Agent::Channel::Handle
40 This channel writes logs to an already opened descriptor, as
41 specified by its file handle: an IO::Handle object, or a GLOB
42 reference such as \*FILE. See Log::Agent::Channel::Handle.
43
44 Log::Agent::Channel::Syslog
45 This channel redirects logs to the syslogd(8) daemon, which will
46 then handle the dispatching to various logfiles, based on its own
47 configuration. See Log::Agent::Channel::Syslog.
48
50 You need not read this section if you're only using "Log::Agent".
51 However, if you wish to implement another channel, then this section
52 might be of interest.
53
54 The following routines are deferred and therefore need to be defined by
55 the heir:
56
57 write($priority, $logstring)
58 Emit the log entry held in $logstring, at priority $priority. A
59 trailing "\n" is added to the $logstring, if needed (i.e. if the
60 physical entity does not do it already, like syslog does).
61
62 The $priority argument must be a valid syslog priority, i.e. one of
63 the following strings: "emerg", "alert", "crit", "err", "warning",
64 "notice", "info", "debug".
65
66 The $logstring may not really be a plain string. It can actually be
67 a Log::Agent::Message object with an overloaded stringification
68 routine, so the illusion should be complete.
69
70 close
71 Close the channel.
72
73 make
74 This is the creation routine. Its signature varies for each
75 channel, naturally.
76
78 Raphael Manfredi <Raphael_Manfredi@pobox.com>
79
81 Log::Agent::Channel::File(3), Log::Agent::Channel::Handle(3),
82 Log::Agent::Channel::Syslog(3), Log::Agent::Logger(3).
83
84
85
86perl v5.38.0 2023-07-20 Agent::Channel(3)