Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error msg: "TypeError: sails.log.blank is not a function" #12

Open
tablenchair opened this issue Feb 10, 2020 · 1 comment
Open

Error msg: "TypeError: sails.log.blank is not a function" #12

tablenchair opened this issue Feb 10, 2020 · 1 comment

Comments

@tablenchair
Copy link

tablenchair commented Feb 10, 2020

I added the module to my new project:
npm install sails-hook-bunyan --save

Created a file "config/bunyan.js" as is on README but changed level to 'debug':

var bunyan = require('sails-hook-bunyan');

module.exports.bunyan = {
    /** If true, a child logger is injected on each request */
    injectRequestLogger: true,

    /** If true, log uncaughtExceptions and terminate the process */
    logUncaughtException: false,

    /** If given, signal to listen on for file rotation */
    rotationSignal: null,

    /** Convenience setting to log to file */
    filePath: null,

    logger: {
        /** Logger name */
        name: 'sails',
        /** Bunyan logging level; defaults to info */
        level: 'debug',
        /** Bunyan serializers */
        serializers: bunyan.stdSerializers,
        /** Array of output streams */
        streams: null
    }
};

Ran sails lift.
I get the following output:


 info: Starting app...

 info: Initializing project hook... (`api/hooks/custom/`)
 info: Initializing `apianalytics` hook...  (requests to monitored routes will be
 logged!)
{"name":"sails","hostname":"hostname.local","pid":63410,"leve
l":30,"msg":"\u001b[36m\u001b[1m·• \u001b[22m\u001b[39m\u001b[1mAuto-migrating...
\u001b[22m\u001b[0m  (alter)\u001b[0m","time":"2020-02-10T23:05:23.409Z","v":0}
{"name":"sails","hostname":"hostname.local","pid":63410,"leve
l":30,"msg":"   \u001b[90mHold tight, this could take a moment.\u001b[39m","time"
:"2020-02-10T23:05:23.410Z","v":0}
{"name":"sails","hostname":"hostname.local","pid":63410,"leve
l":30,"msg":" ✓ Auto-migration complete.","time":"2020-02-10T23:05:23.521Z","v":0
}
/Users/xyz/Desktop/trial/t2/node_modules/sails-hook-orm/lib/initialize.js:461
          sails.log.blank();
                    ^

TypeError: sails.log.blank is not a function
    at /Users/xyz/Desktop/trial/t2/node_modules/sails-hook-orm/lib/initialize.
js:461:21
    at /Users/xyz/Desktop/trial/t2/node_modules/sails-hook-orm/lib/build-ontol
ogy-and-run-auto-migrations.js:135:14
    at afterMigrate (/Users/xyz/Desktop/trial/t2/node_modules/waterline-utils/
lib/auto-migrations/private/run-alter-strategy/index.js:212:12)
    at /Users/xyz/Desktop/trial/t2/node_modules/waterline-utils/node_modules/a
sync/dist/async.js:952:25

and the application stops running. I get the same output even without a "config/bunyan.js" file.

Any advice would be appreciated. Thanks!

@leedm777
Copy link
Contributor

I haven't done much with Sails.js in years, and certainly haven't done any testing with Sails 1.0. Looks like Sails added a new method to their default logger that's not in this hook.

I'd gladly accept a PR and post a release if someone's interested enough to fix the issue. Writing a unit test for the fix would even be more awesomer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants