proxyWithLog
function proxyWithLog(logger, scope): <T>(obj, name) => T;
Curried helper that wraps an object in a logging proxy. Useful when several objects share the same logger and scope and only differ by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
logger | ProxyLogger | Receiver of the log records. |
scope | string | Higher-level grouping shared by every object produced by the returned function. |
Returns
<T>(obj, name): T;
Type Parameters
| Type Parameter |
|---|
T extends object |
Parameters
| Parameter | Type |
|---|---|
obj | T |
name | string |
Returns
T
Example
const wrap = proxyWithLog(logger, 'media');
const trackedCamera = wrap(camera, 'Camera');
const trackedMic = wrap(microphone, 'Microphone');