SERVER-138725Needs Scheduling

Lazily evaluate expressions for logging in CBR

found that we unconditionally log MatchExpressions [here|https://github.com/mongodb/mongo/blob/d48ca0a141adc807e22d47ee8cfd9e3d0ecb2bbb/src/mongo/db/query/compiler/optimizer/cost_based_ranker/ce_cache.h#L76]. We should do this lazily and respect the EnableLogging logging level: bq. If CBR is invoked for large index bounds or match expressions (for example a large $in list), the cost of toString() calls could add up. I had it explore a bit more and for the $in case it found an example where plan

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix

No fix available yet.

Components
Server components related to this issue

No components specified.

Labels
Tags and classification
found-by-ai