The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catalyst::Plugin::DBIC::ConsoleQueryLog - Log DBIC queries and timings to the console

SYNOPSIS

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;
 

DESCRIPTION

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.

METHOD

This plugin exposes the following public methods.

querylog_table

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.

add_querylog_table_row

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.

AUTHOR

John Napiorkowski email:jjnapiork@cpan.org

SEE ALSO

DBIx::Class, DBIx::Class::QueryLog, DBIx::Class::QueryLog::Analyzer, Catalyst, Catalyst::Model::DBIC::Schema, Catalyst::TraitFor::Model::DBIC::Schema::QueryLog,

COPYRIGHT & LICENSE

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.