Chroniton::Messages - an event log for Chroniton
my $log = Chroniton::Messages->new(\*STDERR); $log->message("/etc", "starting backup of /etc"); $log->debug("/etc", "descending into /etc"); $log->warning("/etc/shadow", "can't read /etc/shadow"); $log->error("foo", "can't backup foo: doesn't exist"); $log->add(Chroniton::Event-> ... ); my @errors = $log->retrieve("error"); my @logfile = $log->retrieve_all;
Creates an instance. Argument print is a reference to a filehandle to write each message to. If no filehandle is specified, messages are stored only.
level indicates what level of messages are printed:
level
undef
"errors"
"warnings"
Adds a Chroniton::Message object to the log. Dies if the message isn't actually a message (i.e. can't set ID or query type).
Chroniton::Message
Returns a list of all messages, sorted by their insertion order.
Returns a list of all messages of type type, not sorted.
type
Adds the respective type of message to the database. Chroniton::Message for the argument ordering, as these methods merely serve as a convenient way to write:
$log->add(Chroniton::Message->type(@_));
Returns a string summarizing the event log.
Logs an error, saves the logfile, and then dies (via confess), printing the error message to STDERR and all log entries to STDOUT.
confess
To install Chroniton, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Chroniton
CPAN shell
perl -MCPAN -e shell install Chroniton
For more information on module installation, please visit the detailed CPAN module installation guide.