$log = Log::Dispatch::DBI->new(%params);
This method takes a hash of parameters. The following options are valid:
|-- name, min_level, max_level, callbacks||Same as various Log::Dispatch::* classes.|
|-- dbh||Database handle where Log::Dispatch::DBI throws log message.|
|-- datasource, username, password||If database connection is not yet established, put the DSN, username and password for DBI connect method. Destructor method of Log::Dispatch::DBI disconnects database handle, if the handle is made inside by these parameters. (The method does not disconnect the handle if its supplied with dbh parameter.)|
|-- table||Table name for logging. default is <B>logB>.|
|log_message||inherited from Log::Dispatch::Output.|
Maybe something like this for MySQL.
CREATE TABLE log ( id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, level varchar(9) NOT NULL, message text NOT NULL, timestamp timestamp );
$log->log(level => info, message => too bad);
will execute the following SQL:
INSERT INTO log (level, message) VALUES (info, too bad);
Tatsuhiko Miyagawa <email@example.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||LOG::DISPATCH::DBI (3)||2002-04-11|