Stefan,

You can overwrite the DataObjects::Connection#log(message) method. The
message parameter will be a struct containing the following keys:
:sql, :start, :duration

For a simple example of how to do it, have a look at dm-rails

http://github.com/datamapper/dm-rails/blob/master/lib/dm-rails/setup.rb#L34
http://github.com/datamapper/dm-rails/blob/master/lib/dm-rails/railties/log_listener.rb#L26-39

cheers
snusnu

On Fri, Jun 11, 2010 at 11:56, Stefan Urbanek <[email protected]> wrote:
> Hi,
>
> Is there a way how to measure time of SQL queries being executed?
>
> I am using this to log queries:
>
>    DataObjects::Postgres.logger =
> DataObjects::Logger.new('sql.log', :debug)
>
> but I would like to see how long does it take to execute each query.
> Is that possible? If yes, how?
>
> Stefan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/datamapper?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to