AnyEvent
view release on metacpan or search on metacpan
When set to 7 or higher (info), AnyEvent reports which event model
it chooses.
When set to 8 or higher (debug), then AnyEvent will report extra
information on which optional modules it loads and how it implements
certain features.
"PERL_ANYEVENT_LOG"
Accepts rather complex logging specifications. For example, you
could log all "debug" messages of some module to stderr, warnings
and above to stderr, and errors and above to syslog, with:
PERL_ANYEVENT_LOG=Some::Module=debug,+log:filter=warn,+%syslog:%syslog=error,syslog
For the rather extensive details, see AnyEvent::Log.
This variable is evaluated when AnyEvent (or AnyEvent::Log) is
loaded, so will take effect even before AnyEvent has initialised
itself.
Note that specifying this environment variable causes the
lib/AnyEvent.pm view on Meta::CPAN
When set to C<7> or higher (info), AnyEvent reports which event model it
chooses.
When set to C<8> or higher (debug), then AnyEvent will report extra
information on which optional modules it loads and how it implements
certain features.
=item C<PERL_ANYEVENT_LOG>
Accepts rather complex logging specifications. For example, you could log
all C<debug> messages of some module to stderr, warnings and above to
stderr, and errors and above to syslog, with:
PERL_ANYEVENT_LOG=Some::Module=debug,+log:filter=warn,+%syslog:%syslog=error,syslog
For the rather extensive details, see L<AnyEvent::Log>.
This variable is evaluated when AnyEvent (or L<AnyEvent::Log>) is loaded,
so will take effect even before AnyEvent has initialised itself.
Note that specifying this environment variable causes the L<AnyEvent::Log>
module to be loaded, while C<PERL_ANYEVENT_VERBOSE> does not, so only
lib/AnyEvent/Log.pm view on Meta::CPAN
Another way to view this is that C<< ->level >> filters out messages with
a too low priority, while C<< ->cap >> modifies messages with a too high
priority.
This is useful when different log targets have different interpretations
of priority. For example, for a specific command line program, a wrong
command line switch might well result in a C<fatal> log message, while the
same message, logged to syslog, is likely I<not> fatal to the system or
syslog facility as a whole, but more likely a mere C<error>.
This can be modeled by having a stderr logger that logs messages "as-is"
and a syslog logger that logs messages with a level cap of, say, C<error>,
or, for truly system-critical components, actually C<critical>.
=cut
sub _lvl_lst {
map {
$_ > 0 && $_ <= 9 ? $_+0
: $_ eq "all" ? (1 .. 9)
: $STR2LEVEL{$_} || Carp::croak "$_: not a valid logging level, caught"
lib/AnyEvent/Log.pm view on Meta::CPAN
C<PERL_ANYEVENT_LOG> (or C<AE_LOG>).
The value consists of one or more logging context specifications separated
by C<:> or whitespace. Each logging specification in turn starts with a
context name, followed by C<=>, followed by zero or more comma-separated
configuration directives, here are some examples:
# set default logging level
filter=warn
# log to file instead of to stderr
log=file=/tmp/mylog
# log to file in addition to stderr
log=+%file:%file=file=/tmp/mylog
# enable debug log messages, log warnings and above to syslog
filter=debug:log=+%warnings:%warnings=warn,syslog=LOG_LOCAL0
# log trace messages (only) from AnyEvent::Debug to file
AnyEvent::Debug=+%trace:%trace=only,trace,file=/tmp/tracelog
A context name in the log specification can be any of the following:
lib/AnyEvent/Log.pm view on Meta::CPAN
Perl C<package>. In the unlikely case where you want to specify a package
context that matches on of the other context name forms, you can add a
C<::> to the package name to force interpretation as a package.
=back
The configuration specifications can be any number of the following:
=over 4
=item C<stderr>
Configures the context to use Perl's C<warn> function (which typically
logs to C<STDERR>). Works like C<log_to_warn>.
=item C<file=>I<path>
Configures the context to log to a file with the given path. Works like
C<log_to_file>.
=item C<path=>I<path>
lib/AnyEvent/Log.pm view on Meta::CPAN
};
/\G[[:space:]]+/gc; # skip initial whitespace
while (/\G((?:[^:=[:space:]]+|::|\\.)+)=/gc) {
my $ctx = $pkg->($1);
my $level = "level";
while (/\G((?:[^,:[:space:]]+|::|\\.)+)/gc) {
for ("$1") {
if ($_ eq "stderr" ) { $ctx->log_to_warn;
} elsif (/^file=(.+)/ ) { $ctx->log_to_file ("$1");
} elsif (/^path=(.+)/ ) { $ctx->log_to_path ("$1");
} elsif (/^syslog(?:=(.*))?/ ) { require Sys::Syslog; $ctx->log_to_syslog ("$1");
} elsif ($_ eq "nolog" ) { $ctx->log_cb (undef);
} elsif (/^cap=(.+)/ ) { $ctx->cap ("$1");
} elsif (/^\+(.+)$/ ) { $ctx->attach ($pkg->("$1"));
} elsif ($_ eq "+" ) { $ctx->slaves;
} elsif ($_ eq "off" or $_ eq "0") { $ctx->level (0);
} elsif ($_ eq "all" ) { $ctx->level ("all");
} elsif ($_ eq "level" ) { $ctx->level ("all"); $level = "level";
lib/AnyEvent/Util.pm view on Meta::CPAN
Redirects program standard output into the specified filename, similar to C<<
>filename >> in the shell.
=item ">" => \$data
Appends program standard output to the referenced scalar. The condvar will
not be signalled before EOF or an error is signalled.
Specifying the same scalar in multiple ">" pairs is allowed, e.g. to
redirect both stdout and stderr into the same scalar:
">" => \$output,
"2>" => \$output,
=item ">" => $filehandle
Redirects program standard output to the given filehandle (or actually its
underlying file descriptor).
=item ">" => $callback->($data)
( run in 1.089 second using v1.01-cache-2.11-cpan-49f99fa48dc )