{"record":{"id":"a57131d071c4521c","repo":"winstonjs/winston","slug":"level-log-not-defined-conflicts-with-the-method","errorCode":null,"errorMessage":"Level \"log\" not defined: conflicts with the method \"log\". Use a different level name.","messagePattern":"Level \"log\" not defined: conflicts with the method \"log\"\\. Use a different level name\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/winston/create-logger.js","lineNumber":57,"sourceCode":"     * the prototype of. This is a V8 optimization that is well know to increase\n     * performance of prototype functions.\n     * @param {!Object} options - Options for the created logger.\n     */\n    constructor(options) {\n      super(options);\n    }\n  }\n\n  const logger = new DerivedLogger(opts);\n\n  //\n  // Create the log level methods for the derived logger.\n  //\n  Object.keys(opts.levels).forEach(function (level) {\n    debug('Define prototype method for \"%s\"', level);\n    if (level === 'log') {\n      // eslint-disable-next-line no-console\n      console.warn('Level \"log\" not defined: conflicts with the method \"log\". Use a different level name.');\n      return;\n    }\n\n    //\n    // Define prototype methods for each log level e.g.:\n    // logger.log('info', msg) implies these methods are defined:\n    // - logger.info(msg)\n    // - logger.isInfoEnabled()\n    //\n    // Remark: to support logger.child this **MUST** be a function\n    // so it'll always be called on the instance instead of a fixed\n    // place in the prototype chain.\n    //\n    DerivedLogger.prototype[level] = function (...args) {\n      // Prefer any instance scope, but default to \"root\" logger\n      const self = this || logger;\n\n      // Optimize the hot-path which is the single object.","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/winstonjs/winston/blob/ff0b79de8562bb322c390fbc82fe71c11f373428/lib/winston/create-logger.js#L39-L75","documentation":"When createLogger / winston.createLogger builds per-level methods on the logger prototype, a custom level literally named 'log' is skipped with this console.warn, because it would collide with the existing logger.log() method. Unlike the other entries this is a warning, not a thrown Error — the level still works via logger.log('log', ...) but no logger.log-level() shorthand is defined (and the method remains the generic log).","triggerScenarios":"winston.createLogger({ levels: { log: 0, info: 1, ... } }) — a custom levels object containing the key 'log'.","commonSituations":"Custom level schemes copied from configs that include a catch-all 'log' level; merging default npm levels with custom levels and accidentally including 'log'; YAML/JSON-driven level definitions.","solutions":["Rename the custom level to something that does not collide, e.g. 'verbose' or 'debug', in your levels object.","Update all call sites logger.log() shorthand accordingly (use logger.verbose(msg) after renaming).","If the warning is noise from a third-party levels object, filter 'log' out before passing levels to createLogger."],"exampleFix":"// before\nwinston.createLogger({ levels: { log: 0, info: 1, error: 2 } });\n// after\nwinston.createLogger({ levels: { verbose: 0, info: 1, error: 2 } });","handlingStrategy":"validation","validationCode":"const levels = { log: 0, info: 1, error: 2 };\nif ('log' in levels) {\n  console.warn(\"Renaming reserved custom level 'log'\");\n  const { log, ...rest } = levels;\n  levels = { verbose: log, ...rest };\n}\nwinston.createLogger({ levels });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never name a custom level 'log' — it collides with logger.log().","Lint custom level config against a reserved-word list at startup.","When merging level sets, dedupe and check for 'log' first."],"tags":["winston","custom-levels","naming-conflict","deprecation-warning"],"backgroundTag":"naming-conflict","analyzedSha":"ff0b79de8562bb322c390fbc82fe71c11f373428","analyzedAt":"2026-08-31T13:33:44.585Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}