Hub::Base::Logger - use Hub; my $log = Hub::mkinst( 'Logger', "/var/log/service.log" ); $log->show( "warn, info, foo" );
$log->msg( "I will print b/c level 'info' is specified", 'info' ); $log->msg( "I will print b/c there is no type" ); $log->err( "$!: $filename" ); $log->msg( "I will not print", "kmfdm" ); $log->flush(); # write to file (also called on DESTROY)
Part of the Hub Library
Record log messages, write them to file and append to stdout.
This logger is used by this library. Logging levels are not standardized, but you can specify show( 'all' ) to see what gets used.
Always available:
Unspecified messages err Error, fatal errors such as configuration issues. (always print, unless 'opressed' is set)
These are used by this library, and may also server as examples:
info Informational, users will set this as the default to get a warm fuzzy of program flow. warn Warning, non-fatal errors such as configuration issues. verb Verbose, programmers will look at this output to determine where to start debugging an error. dbg Debug, these messages are useless unless you know what you're looking for.
No logging
Usage: dump [MESSAGE], ?REF, [LEVEL]
Where:
MESSAGE An optional message to prefix the output ?REF A reference to the value which will be dumped LEVEL The level passed as a flag, -verb for example.
Dump hash|array values. ?REF? may not be a HASH or ARRAY reference, since this method is used to inspect variables. In that case, it will treated like a scalar.
Usage: flush Usage: flush -tstamp => TIMESTAMP flush -tee => none|html|stdout|stderr
Write log messages to disk.
Optionally tee these messages (to stdout or stderr or stdout wrapped with HTML comments).
TIMESTAMP as from Time::HiRes::gettimeofday.
Usage: morte
Log the message as an error, flush the log file, and die with the message.
Log a message at a specific level
write directly to standard out
Toggle output options
'all' will display all messages. Otherwise, specify the message level (see 'msg' below.)
Append messages to stdout (0=no, 1=html, 2=raw)
keep the logfile below a certian size
Ryan Gies
Copyright (c) 2006 Livesite Networks, LLC. All rights reserved.
Copyright (c) 2000-2005 Ryan Gies. All rights reserved.
This file created by on at
To install Hub, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hub
CPAN shell
perl -MCPAN -e shell install Hub
For more information on module installation, please visit the detailed CPAN module installation guide.