Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54596

1-arg shouldLog violates One Definition Rule

    • Fully Compatible
    • ALL
    • Security 2021-03-22
    • 2

      [subtask of SERVER-52604]

      mongo::shouldLog(component, severity) is fine.

      mongo::shouldLog(severity) fills in the default component by referring to a variable in the anonymous namespace. So a program will have multiple mongo::shouldLog(severity) definitions, all referring to completely different component variables. This is a violation of the One Definition Rule.

      Can be easily fixed, just remove the 1-arg shouldLog function. Replace all callers (7 or so) with shouldLog(MONGO_LOGV2_DEFAULT_COMPONENT, severity)

      https://github.com/mongodb/mongo/commit/955af4ef6fa94b76a24faa810435181b5ee3e140

       

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: