{"id":"01b086e97a97f2ce","repo":"sequelize/sequelize","slug":"the-logging-option-must-be-set-to-a-function-or","errorCode":null,"errorMessage":"The \"logging\" option must be set to a function or false, not true. If you want to log all queries, set it to `console.log`.","messagePattern":"The \"logging\" option must be set to a function or false, not true\\. If you want to log all queries, set it to `console\\.log`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/sequelize-typescript.ts","lineNumber":454,"sourceCode":"\nExample for Postgres:\n\nnew Sequelize({\n  dialect: PostgresDialect,\n  url: 'postgres://user:pass@localhost/dbname',\n});`);\n    }\n\n    // @ts-expect-error -- sanity check\n    if (options.pool === false) {\n      throw new Error(\n        'Setting the \"pool\" option to \"false\" is not supported since Sequelize 4. To disable the pool, set the \"pool\".\"max\" option to 1.',\n      );\n    }\n\n    // @ts-expect-error -- sanity check\n    if (options.logging === true) {\n      throw new Error(\n        'The \"logging\" option must be set to a function or false, not true. If you want to log all queries, set it to `console.log`.',\n      );\n    }\n\n    // @ts-expect-error -- sanity check\n    if (options.operatorsAliases) {\n      throw new Error(\n        'String based operators have been removed. Please use Symbol operators, read more at https://sequelize.org/docs/v7/core-concepts/model-querying-basics/#deprecated-operator-aliases',\n      );\n    }\n\n    if ('dialectModulePath' in options) {\n      throw new Error(\n        'The \"dialectModulePath\" option has been removed, as it is not compatible with bundlers. Please refer to the documentation of your dialect at https://sequelize.org to learn about the alternative.',\n      );\n    }\n\n    if ('dialectModule' in options) {","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/sequelize/sequelize/blob/7e1deec499d5afbb8d1877c2f4d545cead1214ec/packages/core/src/sequelize-typescript.ts#L436-L472","documentation":"The logging option must be either a function (called per query with the SQL string) or false (to silence logging). The boolean true is rejected because it implies logging but provides no sink; use console.log explicitly.","triggerScenarios":"Passing { logging: true } to the Sequelize constructor or to query options.","commonSituations":"Developers toggling logging on with a boolean; copied config snippets.","solutions":["Set logging: console.log to log every query.","Set logging: false to disable logging.","Pass a custom (sql, timing?) => void function."],"exampleFix":"// before\nnew Sequelize({ dialect, logging: true });\n\n// after\nnew Sequelize({ dialect, logging: console.log });","handlingStrategy":"validation","validationCode":"if (options.logging === true) {\n  options.logging = console.log;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use console.log or a function for logging; never the boolean true."],"tags":["sequelize","logging","config"],"analyzedSha":"7e1deec499d5afbb8d1877c2f4d545cead1214ec","analyzedAt":"2026-08-03T18:58:44.549Z","schemaVersion":2}