@dgac/nmb2b-client
Version:
EUROCONTROL Network Manager B2B SOAP client
21 lines (19 loc) • 574 B
JavaScript
import debug_default from "../debug.js";
//#region src/utils/instrumentation/withLog.ts
function withLog(namespace) {
const debug = debug_default(namespace);
return (fn) => (values, options) => {
if (values) debug("Called with input %o", values);
else debug("Called");
return fn(values, options).then((res) => {
debug("Succeded");
return res;
}, (err) => {
debug("Failed");
return Promise.reject(err instanceof Error ? err : new Error("Unknown error", { cause: err }));
});
};
}
//#endregion
export { withLog };
//# sourceMappingURL=withLog.js.map