1Agent::Channel::Handle(U3s)er Contributed Perl DocumentatAigoennt::Channel::Handle(3)
2
3
4
6 Log::Agent::Channel::Handle - I/O handle logging channel for Log::Agent
7
9 require Log::Agent::Channel::Handle;
10
11 my $driver = Log::Agent::Channel::Handle->make(
12 -prefix => "prefix",
13 -stampfmt => "own",
14 -showpid => 1,
15 -handle => \*FILE,
16 );
17
19 The handle channel performs logging to an already opened I/O handle,
20 along with the necessary prefixing and stamping of the messages.
21
22 The creation routine make() takes the following arguments:
23
24 "-handle" => handle
25 Specifies the I/O handle to use. It can be given as a GLOB
26 reference, such as "\*FILE", or as an "IO::Handle" object.
27
28 NOTE: Auto-flushing is not enabled on the handle. Even when the
29 channel is closed, the handle is left as-is: we simply stop sending
30 log messages to it.
31
32 "-no_newline" => flag
33 When set to true, never append any "\n" (on Unix) or "\r\n" (on
34 Windows) to log messages.
35
36 Internally, Log::Agent relies on the channel to delimit logged
37 lines appropriately, so this flag is not used. However, it might
38 be useful for "Log::Agent::Logger" users.
39
40 Default is false, meaning newline markers are systematically
41 appended.
42
43 "-no_prefixing" => flag
44 When set to true, disable the prefixing logic entirely, i.e. the
45 following options are ignored completely: "-prefix", "-showpid",
46 "-no_ucfirst", "-stampfmt".
47
48 Default is false.
49
50 "-no_ucfirst" => flag
51 When set to true, don't upper-case the first letter of the log
52 message entry when there's no prefix inserted before the logged
53 line. When there is a prefix, a ":" character follows, and
54 therefore the leading letter of the message should not be upper-
55 cased anyway.
56
57 Default is false, meaning uppercasing is performed.
58
59 "-prefix" => prefix
60 The application prefix string to prepend to messages.
61
62 "-showpid" => flag
63 If set to true, the PID of the process will be appended within
64 square brackets after the prefix, to all messages.
65
66 Default is false.
67
68 "-stampfmt" => (name | CODE)
69 Specifies the time stamp format to use. By default, my "own" format
70 is used. See Log::Agent::Stamping for a description of the
71 available format names.
72
73 You may also specify a CODE ref: that routine will be called every
74 time we need to compute a time stamp. It should not expect any
75 parameter, and should return a string.
76
78 Beware of chdir(). If your program uses chdir(), you should always
79 specify logfiles by using absolute paths, otherwise you run the risk of
80 having your relative paths become invalid: there is no anchoring done
81 at the time you specify them. This is especially true when configured
82 for rotation, since the logfiles are recreated as needed and you might
83 end up with many logfiles scattered throughout all the directories you
84 chdir()ed to.
85
87 Raphael Manfredi <Raphael_Manfredi@pobox.com>
88
90 Log::Agent::Logger(3), Log::Agent::Channel(3).
91
92
93
94perl v5.32.1 2021-02-15 Agent::Channel::Handle(3)