correction: DataMapper::Logger instead of DataMapper.Logger

Furthermore, DataMapper::Logger.new will create a singleton logger
object?
It is too fancy than DataMapper.logger = a_logger, and I don't think
it follows DM's explicit principle.


On 10月21日, 上午3时42分, Martin Gamsjaeger <[email protected]> wrote:
> The common approach to setup logging is the following (actually,
> that's the skeleton for any standalone snippet of dm code)
>
> require 'rubygems'
> require 'dm-core'
>
> DataMapper.Logger.new($stdout, :debug)
> DataMapper.setup(:default, 'sqlite3:memory:')
>
> # some models and test code
>
> __END__
>
> # the output of the script
>
> I will try to get that information onto the website.
>
> cheers
> snusnu
>
>
>
> On Tue, Oct 20, 2009 at 20:19, sliu <[email protected]> wrote:
>
> > My requirement is simple: see SQLs generated by DM.
>
> > After reading dm-core's FQA and deep google search, I only got several
> > outdated information, util I found this thread:
>
> >http://groups.google.com/group/datamapper/browse_thread/thread/fa66b0...
>
> > From above link, the right answer is:
>
> > require 'logger'
>
> > # assign a standard logger explicitly, with debug level to trace SQL.
> > # and, these two line should be ahead of DataMapper.setup, otherwise,
> > SQL won't be ouput. Strange behavior, and I think it is a BUG?
>
> > DataMapper.logger = Logger.new(STDOUT)
> > DataMapper.logger.level = Logger::DEBUG
>
> > DataMapper.setup(:default, ......)
>
> > Could anyone help to update dm-core's FAQ and add it to official
> > documentation(datamapper.org)?
>
> > I think it is important enough and may be used frequently.
--~--~---------~--~----~------------~-------~--~----~
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