Cli: Logging parameter in config.json bug

Created on 2 Apr 2015  路  12Comments  路  Source: sequelize/cli

  • Setting logging to false in config.json disables logging, as expected. However, setting it to true throws an error shown below. You can't define a function in a json file, so you can't implement a custom logging handler nor set it to console.log.

DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log

  • Omitting the logging value all together actually disables logging on the CLI, although the above message would make one think it will default to console.log.

Most helpful comment

While this is more of a workaround than a fix for your problem: Update to the lastest version of the cli, rename the config file to config.js and add a module.export. Now you can set it to console.log.

All 12 comments

+1

good point.

+1

While this is more of a workaround than a fix for your problem: Update to the lastest version of the cli, rename the config file to config.js and add a module.export. Now you can set it to console.log.

+1

+1

I just ran into this problem. +1 from me as well

As @sdepold said, you just need to export your conf as javascript :
module.exports = { database: { host: "", port: "", ..., logging: console.log } }

He also said "this is more of a workaround than a fix for your problem"

+1

Closing (Issue Cleanup), Please comment if you want to keep it open

I use this line of code to enable / disable according to environment:

logging: (process.env.NODE_ENV !== 'production' ? console.log : null)
Was this page helpful?
0 / 5 - 0 ratings