Skip to content

Commit

Permalink
Better error msg for 'Unsupported logger override' (custom logger) --…
Browse files Browse the repository at this point in the history
… and also upgrade Lodash dep to 3.10.2.
  • Loading branch information
mikermcneil committed Nov 17, 2016
1 parent dd400a9 commit 56ea7f4
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 12 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

var util = require('util');
var _ = require('@sailshq/lodash');
var rc = require('rc');
var wrap = require('./lib/wrap');
var configure = require('./lib/configure');
Expand Down Expand Up @@ -50,12 +51,13 @@ module.exports = function CaptainsLog(overrides) {
//
// We assume that at least something called
// `logger.log` or `logger.debug` exists.
if (!logger.log) {
if (!_.isObject(logger) || !_.isFunction(logger.log)) {
throw new Error(
'Unsupported logger override!\n' +
'(has no `.log()` or `.debug()` method.)'
'Unsupported logger override provided as `custom`!\n' +
'(has no `.log()` or `.debug()` method.)\n'+
'Here\'s what was passed in:\n'+util.inspect(logger,{depth:null})
);
}
}//-•

// Fill in the gaps for the required log methods with
// reasonable guesses if the custom logger is missing any
Expand Down
2 changes: 1 addition & 1 deletion lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Module dependencies.
*/

var _ = require('lodash');
var _ = require('@sailshq/lodash');
var rc = require('rc');
var chalk = require('chalk');
var DEFAULT = require('./defaults');
Expand Down
2 changes: 1 addition & 1 deletion lib/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var util = require('util');
var _ = require('lodash');
var _ = require('@sailshq/lodash');



Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"dependencies": {
"chalk": "1.1.3",
"lodash": "3.10.1",
"@sailshq/lodash": "^3.10.2",
"rc": "1.0.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/assertions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Module dependencies
*/

var _ = require('lodash');
var _ = require('@sailshq/lodash');
var assert = require('assert');


Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/_pause-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Module dependencies
*/

var _ = require('lodash');
var _ = require('@sailshq/lodash');



Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/_record-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Module dependencies
*/

var _ = require('lodash');
var _ = require('@sailshq/lodash');



Expand Down
2 changes: 1 addition & 1 deletion test/standalone/bind-all-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Module dependencies
*/

var _ = require('lodash');
var _ = require('@sailshq/lodash');



Expand Down
2 changes: 1 addition & 1 deletion test/suites/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Dependencies
*/
var _ = require('lodash');
var _ = require('@sailshq/lodash');
var StreamObserver = require('fixture-stdout');
var expect = require('../assertions');
var fixtures = require('../fixtures');
Expand Down

0 comments on commit 56ea7f4

Please sign in to comment.