{"record":{"id":"8ce62ec89890ed49","repo":"winstonjs/winston","slug":"colors-emiterrs-formatters-padlevels-rewrite","errorCode":null,"errorMessage":"{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.\nUse a custom winston.format(function) instead.\nSee: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md","messagePattern":"(.+?) were removed in winston@3\\.0\\.0\\.\nUse a custom winston\\.format\\(function\\) 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":137,"sourceCode":"    this.rejections = new RejectionHandler(this);\n    this.profilers = {};\n    this.exitOnError = exitOnError;\n\n    // Add all transports we have been provided.\n    if (transports) {\n      transports = Array.isArray(transports) ? transports : [transports];\n      transports.forEach(transport => this.add(transport));\n    }\n\n    if (\n      colors ||\n      emitErrs ||\n      formatters ||\n      padLevels ||\n      rewriters ||\n      stripColors\n    ) {\n      throw new Error(\n        [\n          '{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.',\n          'Use a custom winston.format(function) instead.',\n          'See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md'\n        ].join('\\n')\n      );\n    }\n\n    if (exceptionHandlers) {\n      this.exceptions.handle(exceptionHandlers);\n    }\n    if (rejectionHandlers) {\n      this.rejections.handle(rejectionHandlers);\n    }\n  }\n\n  /**\n   * Helper method to get the highest logging level associated with a logger","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/winstonjs/winston/blob/ff0b79de8562bb322c390fbc82fe71c11f373428/lib/winston/logger.js#L119-L155","documentation":"In winston 3, `logger.configure(options)` rejects the removed winston 2.x options — `colors`, `emitErrs`, `formatters`, `padLevels`, `rewriters`, `stripColors`. This also fires via the Logger constructor, which delegates to configure. The rewrite moved all message shaping into the `winston.format` pipeline, so these legacy options are treated as a hard configuration error with a pointer to the upgrade guide.","triggerScenarios":"Passing any of `{ colors, emitErrs, formatters, padLevels, rewriters, stripColors }` in the options object to `new winston.Logger({...})` or `logger.configure({...})` — e.g. `new winston.Logger({ colors: {...} })` or `configure({ rewriters: [...] })`.","commonSituations":"Direct winston 2.x -> 3.x migration where the old logger options object is reused; config files loaded from JSON containing v2 option names; frameworks or wrappers that still emit v2-style logger options.","solutions":["Delete the removed options from the config object.","Move level/`colors` customization to `winston.addColors(colors)` and level sets via the `levels` option.","Replace formatters/rewriters/stripColors/padLevels with `winston.format.combine(...)` including `format.colorize()`, `format.padLevels()`, `format.printf()`, or a custom `winston.format(fn)`.","Remove `emitErrs` and handle transport errors via the logger/transport `error` event instead.","Follow UPGRADE-3.0.md for a per-option mapping."],"exampleFix":"// before (winston 2.x)\nconst logger = new winston.Logger({\n  colors: { info: 'blue' },\n  padLevels: true,\n  rewriters: [(level, msg, meta) => meta]\n});\n\n// after (winston 3.x)\nwinston.addColors({ info: 'blue' });\nconst logger = winston.createLogger({\n  format: winston.format.combine(\n    winston.format.colorize(),\n    winston.format.padLevels()\n  ),\n  transports: [new winston.transports.Console()]\n});","handlingStrategy":"validation","validationCode":"const REMOVED = ['colors', 'emitErrs', 'formatters', 'padLevels', 'rewriters', 'stripColors'];\nconst bad = REMOVED.filter(k => k in loggerOptions);\nif (bad.length) throw new TypeError(`Removed winston 2.x options: ${bad.join(', ')} — migrate to winston.format`);","typeGuard":null,"tryCatchPattern":"try {\n  logger.configure(opts);\n} catch (err) {\n  if (err.message.includes('were removed in winston@3.0.0')) {\n    const { colors, ...rest } = opts;\n    if (colors) winston.addColors(colors);\n    logger.configure(rest);\n  } else { throw err; }\n}","preventionTips":["Sanitize config objects loaded from JSON/files against a winston 3 schema","Replace v2 option names during migration using UPGRADE-3.0.md as a checklist","Construct the logger once in a dedicated module so legacy options surface in tests","Keep wrapper libraries' option passthrough updated to the winston 3 surface"],"tags":["winston","configuration","breaking-change","format"],"backgroundTag":"invalid-logger-options","analyzedSha":"ff0b79de8562bb322c390fbc82fe71c11f373428","analyzedAt":"2026-08-31T13:33:44.585Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}