Catalyst::TraitFor::Model::DBIC::Schema::QueryLog::AdoptPlack - Use a Plack Middleware QueryLog
package MyApp::Web::Model::Schema; use parent 'Catalyst::Model::DBIC::Schema'; __PACKAGE__->config({ schema_class => 'MyApp::Schema', traits => ['QueryLog::AdoptPlack'], ## .. rest of configuration });
This is a trait for Catalyst::Model::DBIC::Schema which adopts a Plack created DBIx::Class::QueryLog and logs SQL for a given request cycle. It is intended to be compatible with Catalyst::TraitFor::Model::DBIC::Schema::QueryLog which you may already be using.
It picks up the querylog from $env->{'plack.middleware.debug.dbic.querylog'} which is generally provided by the Plack middleware Plack::Middleware::Debug::DBIC::QueryLog In fact you will probably use these two modules together. Please see the documentation in Plack::Middleware::Debug::DBIC::QueryLog for an example.
$env->{'plack.middleware.debug.dbic.querylog'}
This model defines the following options.
Takes a DBIx::Class::QueryLog object, which is used as the querylog for the application. Generally the whole point of this trait is to adopt the query log provided by the Plack middleware, but if you have special needs you can set an instance here. You may wish to do this if you have complicated instatiation needs.
Takes a HashRef which is passed to DBIx::Class::QueryLog at construction, if needed.
Plack::Middleware::Debug::DBIC::QueryLog, Catalyst::TraitFor::Model::DBIC::Schema::QueryLog, Catalyst::Model::DBIC::Schema, Plack::Middleware::Debug
This code is basically copied from Catalyst::TraitFor::Model::DBIC::Schema::QueryLog and the author owes a debt of gratitude for the original authors.
John Napiorkowski, <jjnapiork@cpan.org>
<jjnapiork@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::TraitFor::Model::DBIC::Schema::QueryLog::AdoptPlack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::TraitFor::Model::DBIC::Schema::QueryLog::AdoptPlack
CPAN shell
perl -MCPAN -e shell install Catalyst::TraitFor::Model::DBIC::Schema::QueryLog::AdoptPlack
For more information on module installation, please visit the detailed CPAN module installation guide.