MCPcopy
hub / github.com/mongodb/node-mongodb-native / interpolateMsg

Function interpolateMsg

etc/crawfish.mjs:99–113  ·  view source on GitHub ↗
(log)

Source from the content-addressed store, hash-verified

97}
98
99function interpolateMsg(log) {
100 if (!log.msg) return;
101
102 if (!log.attr) return;
103
104 for (const key in log.attr) {
105 if (Reflect.has(log.attr, key)) {
106 log.msg = log.msg.split(`{${key}}`).join(`${JSON.stringify(log.attr[key])}`);
107 delete log.attr[key];
108 }
109 }
110
111 if (Object.keys(log.attr).length === 0) delete log.attr;
112 log.msg = log.msg.split(`"`).join(`'`);
113}
114
115function friendlyDate(log) {
116 const dateString = typeof log.t === 'string' ? log.t : log.t.$date;

Callers 1

mainFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected