Treex::Core::Log - logger tailored for the needs of Treex
version 2.20151210
use Treex::Core::Log; Treex::Core::Log::log_set_error_level('DEBUG'); sub epilog { print STDERR "I'm going to cease!"; } Treex::Core::Log::add_hook('FATAL',&epilog()); sub test_value { my $value = shift; log_fatal "Negative values are unacceptable" if $ARGV < 0; log_warn "Zero value is suspicious" if $ARGV == 0; log_debug "test: value=$value"; }
Treex::Core::Log is a logger developed with the Treex system. It uses more or less standard leveled set of reporting functions, printing the messages at STDERR.
Treex::Core::Log
STDERR
Note that this module might be completely substituted by more elaborate solutions such as Log::Log4perl in the whole Treex in the future
Specifying error level can be used for suppressing reports with lower severity. This module supports four ordered levels of report severity (plus a special value comprising them all).
The current error level can be accessed by the following functions:
All the following functions are exported by default.
print the message, print the Perl stack too, and exit
print the consumed memory
print another asterisk in a 'progress bar' composed of asterisks
Another functions can be called prior to reporting events, by hooking a function on a certain error level event.
add the subroutine to the list of subroutines called prior to reporting events with the given level
run all subroutines for the given error level
Zdeněk Žabokrtský <zabokrtsky@ufal.mff.cuni.cz>
Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Treex::Core, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Treex::Core
CPAN shell
perl -MCPAN -e shell install Treex::Core
For more information on module installation, please visit the detailed CPAN module installation guide.