function logCall(obj, method) {
	let old = obj[method];
	obj[method] = function (...args) {
		let c = '';
		for (let i = 0; i < args.length; i++) {
			if (c) c += ', ';
			c += serialize(args[i]);
		}

		let operation;
		switch (method) {
			case 'insertBefore': {
				if (args[1] === null && args.length === 2) {
					operation = `${serialize(this)}.appendChild(${serialize(args[0])})`;
				} else {
					operation = `${serialize(this)}.${String(method)}(${c})`;
				}
				break;
			}
			default: {
				operation = `${serialize(this)}.${String(method)}(${c})`;
				break;
			}
		}

		log.push(operation);
		return old.apply(this, args);
	};

	return () => (obj[method] = old);
}
Modify obj's original method to log calls and arguments on logger object
@template T
@param {T} obj
@param {keyof T} method