{"record":{"id":"0ddbaf07b2e6831c","repo":"winstonjs/winston","slug":"s-was-removed-in-winston-3-0-0","errorCode":null,"errorMessage":"{ %s } was removed in winston@3.0.0.","messagePattern":"(.+?) was removed in winston@3\\.0\\.0\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/winston/common.js","lineNumber":21,"sourceCode":" *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use strict';\n\nconst { format } = require('util');\n\n/**\n * Set of simple deprecation notices and a way to expose them for a set of\n * properties.\n * @type {Object}\n * @private\n */\nexports.warn = {\n  deprecated(prop) {\n    return () => {\n      throw new Error(format('{ %s } was removed in winston@3.0.0.', prop));\n    };\n  },\n  useFormat(prop) {\n    return () => {\n      throw new Error([\n        format('{ %s } was removed in winston@3.0.0.', prop),\n        'Use a custom winston.format = winston.format(function) instead.'\n      ].join('\\n'));\n    };\n  },\n  forFunctions(obj, type, props) {\n    props.forEach(prop => {\n      obj[prop] = exports.warn[type](prop);\n    });\n  },\n  forProperties(obj, type, props) {\n    props.forEach(prop => {\n      const notice = exports.warn[type](prop);","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/winstonjs/winston/blob/ff0b79de8562bb322c390fbc82fe71c11f373428/lib/winston/common.js#L3-L39","documentation":"winston exposes a `deprecated(prop)` helper in lib/winston/common.js that returns a throwing function. When code calls a winston 2.x API property that was removed in the 3.0.0 rewrite (wired via `forFunctions`/`forProperties` onto exports like `winston.transports` or `winston.Logger` internals), the thrown Error is formatted as `{ <prop> } was removed in winston@3.0.0.` It exists to fail fast instead of silently no-op on removed APIs.","triggerScenarios":"Calling any winston 2.x-era function that was replaced in winston 3 and proxied through `warn.deprecated(prop)` — e.g. accessing removed helpers on the winston namespace or logger such as `winston.setLevels`, `winston.addColors`-style legacy shims, or other prop names registered with `deprecated()` in common.js.","commonSituations":"Upgrading an app from winston 2.x to 3.x without following UPGRADE-3.0.md; copy-pasted logging code from old tutorials or Stack Overflow answers; transitive dependencies still written against the winston 2.x API.","solutions":["Read the message's `{ prop }` name and look up its winston 3 replacement in UPGRADE-3.0.md, then update the call site.","Replace removed convenience APIs with the winston 3 equivalents: `winston.createLogger` + `format.*` combinators instead of formatters/rewriters, and `transports.*` classes instead of legacy helpers.","Pin/upgrade any third-party package that depends on winston 2.x APIs to a winston-3-compatible version.","As a stopgap, pin winston to ^2.4.x — but only for legacy apps that cannot be migrated yet."],"exampleFix":"// before (winston 2.x)\nwinston.setLevels(winston.config.syslog.levels);\n\n// after (winston 3.x)\nconst logger = winston.createLogger({\n  levels: winston.config.syslog.levels,\n  transports: [new winston.transports.Console()]\n});","handlingStrategy":"validation","validationCode":"const REMOVED_V2 = ['setLevels', 'addRewriter', 'addFormatter', 'cli', 'padLevels', 'clamp'];\nif (REMOVED_V2.some(fn => typeof winston[fn] === 'function' && winston[fn].toString().includes('removed in winston@3'))) {\n  throw new Error('winston 2.x API detected; migrate to winston 3 (see UPGRADE-3.0.md)');\n}","typeGuard":"function isWinston3(w) { return typeof w.createLogger === 'function'; }","tryCatchPattern":"try {\n  legacyWinstonCall();\n} catch (err) {\n  if (err.message.includes('was removed in winston@3.0.0')) {\n    migrateToWinston3();\n  } else { throw err; }\n}","preventionTips":["Run winston upgrade codemods/tests before bumping the major version","Grep CI for winston 2.x-only APIs (setLevels, cli(), formatters, rewriters)","Pin winston ^3.x in package.json and check transitive deps with `npm ls winston`","Follow UPGRADE-3.0.md when migrating"],"tags":["winston","deprecation","breaking-change","upgrade"],"backgroundTag":"removed-in-major-version","analyzedSha":"ff0b79de8562bb322c390fbc82fe71c11f373428","analyzedAt":"2026-08-31T13:33:44.585Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}