gruntjs / grunt-legacy-log

The Grunt logger.
MIT License
5 stars 19 forks source link

TypeError: Object #<Object> has no method '_format' #1

Closed dylang closed 10 years ago

dylang commented 10 years ago

Before grunt 0.4.5 you could do this:

var log = grunt.log.ok;
...
log('This is going to throw an exception.');

grunt 0.4.5 switched to grunt-legacy-log which changed how ok is exposed in such a way that calling log() in the above example, the context is lost and the code in grunt-legacy-log that tries to use this will throw an exception.

A fix for this is:

var log = grunt.log.ok.bind(grunt.log);
...
log('This is going to output using grunt\'s logger.');

But I would argue this is an unexpected breaking change and not good artifact for the api to have.

cowboy commented 10 years ago

Yeah, I'm going to fix and release 0.4.6 shortly.

cowboy commented 10 years ago

@dylang can you npm update and see if it picks up grunt-legacy-log@0.1.1?

cowboy commented 10 years ago

If this works I won't need to update Grunt, I'll just tell people experiencing the problem to update.

dylang commented 10 years ago

Thanks for the quick fix!

:heart: :heart: :heart:

cowboy commented 10 years ago

@dylang did npm update fix it, or did you have to do something more severe?

dylang commented 10 years ago

npm update fixed the problem.