Catalyst::Plugin::DBIC::ConsoleQueryLog - Log DBIC queries and timings to the console
Use the plugin in your application class:
package MyApp; use Catalyst qw/DBIC::ConsoleQueryLog/; __PACKAGE__->config( 'Plugin::DBIC::ConsoleQueryLog' => { model_name => 'Schema' }, 'Model::Schema' => { # This is a model of Catalyst::Model::DBIC::Schema schema_class => 'MyApp::Schema', traits => ['QueryLog'], # Please note you NEED to use this trait. }, ); __PACKAGE__->setup;
This is a very basic console logger for DBIx::Class::QueryLog::Analyzer, which you might be using in Catalyst via Catalyst::TraitFor::Model::DBIC::Schema::QueryLog in order to get tracing and performance information on you SQL calls. You must be using Catalyst::Model::DBIC::Schema and have added the Catalyst::TraitFor::Model::DBIC::Schema::QueryLog trait in configuration as in the "SYNOPSIS" example.
I wrote this because I got tired of adding it manually over and over to my basic application framework. However its a very basic logger that doesn't support some of the more powerful bits such as creating buckets to classify you logging, etc. It will get you started but eventually you'll need to roll your own as you needs become more complex.
Console logging will only occur when the application is run in debug mode. I recommend only adding this plugin in development since it's needless overhead in production.
This plugin exposes the following public methods.
Returns an instance of Text::SimpleTable that is setup to display the rows of querylog information. You can override this if you trying to customize the querylog information.
Receives an instance of Text::SimpleTable, and DBIx::Class::QueryLog::Analyzer so that you can customize drawing a row of data. Override if you are adding custom display information.
John Napiorkowski email:jjnapiork@cpan.org
DBIx::Class, DBIx::Class::QueryLog, DBIx::Class::QueryLog::Analyzer, Catalyst, Catalyst::Model::DBIC::Schema, Catalyst::TraitFor::Model::DBIC::Schema::QueryLog,
Copyright 2017, John Napiorkowski email:jjnapiork@cpan.org
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Plugin::DBIC::ConsoleQueryLog, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::DBIC::ConsoleQueryLog
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::DBIC::ConsoleQueryLog
For more information on module installation, please visit the detailed CPAN module installation guide.