{"record":{"id":"579f28537d88ad32","repo":"winstonjs/winston","slug":"logger-cli-was-removed-in-winston-3-0-0-use-a-cu","errorCode":null,"errorMessage":"Logger.cli() was removed in winston@3.0.0\nUse a custom winston.formats.cli() instead.\nSee: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md","messagePattern":"Logger\\.cli\\(\\) was removed in winston@3\\.0\\.0\nUse a custom winston\\.formats\\.cli\\(\\) instead\\.\nSee: https://github\\.com/winstonjs/winston/tree/master/UPGRADE-3\\.0\\.md","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/winston/logger.js","lineNumber":638,"sourceCode":"  /**\n   * Backwards compatibility to `exceptions.handle` in winston < 3.0.0.\n   * @returns {undefined}\n   * @deprecated\n   */\n  unhandleExceptions(...args) {\n    // eslint-disable-next-line no-console\n    console.warn(\n      'Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()'\n    );\n    this.exceptions.unhandle(...args);\n  }\n\n  /**\n   * Throw a more meaningful deprecation notice\n   * @throws {Error} - TODO: add throws description.\n   */\n  cli() {\n    throw new Error(\n      [\n        'Logger.cli() was removed in winston@3.0.0',\n        'Use a custom winston.formats.cli() instead.',\n        'See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md'\n      ].join('\\n')\n    );\n  }\n\n  /**\n   * Bubbles the `event` that occured on the specified `transport` up\n   * from this instance.\n   * @param {string} event - The event that occured\n   * @param {Object} transport - Transport on which the event occured\n   * @private\n   */\n  _onEvent(event, transport) {\n    function transportEvent(err) {\n      // https://github.com/winstonjs/winston/issues/1364","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/winstonjs/winston/blob/ff0b79de8562bb322c390fbc82fe71c11f373428/lib/winston/logger.js#L620-L656","documentation":"`Logger.prototype.cli()` was a winston 2.x convenience that switched the logger to CLI-style output formatting. It was removed in the 3.0.0 rewrite, and the method is kept only to throw a migration notice pointing at `winston.formats.cli()` (the format combinator) and the UPGRADE-3.0.md guide.","triggerScenarios":"Calling `logger.cli()` (or `winston.cli()`) on any winston 3 logger instance — always throws, no conditions.","commonSituations":"Running winston 2.x-era code on winston 3; tutorials showing `winston.cli()`; automated migrations that preserved old method calls.","solutions":["Remove the `logger.cli()` call.","Use the CLI format instead: add `winston.format.cli()` to the logger's `format` combine chain.","If CLI coloring/levels behavior is wanted, combine `format.colorize()`, `format.padLevels()`, `format.errors()`, `format.cli()` as needed.","Follow UPGRADE-3.0.md section on CLI output."],"exampleFix":"// before (winston 2.x)\nconst logger = new winston.Logger();\nlogger.cli();\n\n// after (winston 3.x)\nconst logger = winston.createLogger({\n  format: winston.format.cli(),\n  transports: [new winston.transports.Console()]\n});","handlingStrategy":"validation","validationCode":"if (typeof logger.cli === 'function') {\n  try { logger.cli; } finally { /* cli() always throws on winston 3 — remove the call */ }\n}","typeGuard":"function supportsCli(x) { return typeof x.cli === 'function' && x.constructor && !/removed/.test(x.cli.toString()); }","tryCatchPattern":"try {\n  logger.cli();\n} catch (err) {\n  if (err.message.includes('Logger.cli() was removed')) {\n    logger.configure({ format: winston.format.cli() });\n  } else { throw err; }\n}","preventionTips":["Remove cli() calls when bumping to winston 3 — it always throws","Use `format.cli()` in the format chain instead","Add a startup smoke test that builds the logger with intended format","Scan codebase for `\\.cli()` during dependency upgrades"],"tags":["winston","deprecation","breaking-change","format"],"backgroundTag":"removed-in-major-version","analyzedSha":"ff0b79de8562bb322c390fbc82fe71c11f373428","analyzedAt":"2026-08-31T13:33:44.585Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}