Skip to content

Commit 707a06c

Browse files
committed
refactor: undo necessary changes
1 parent 711a77e commit 707a06c

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

packages/core/src/shared/logger/perfLogger.ts

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -27,54 +27,3 @@ export class PerfLog {
2727
this.log.verbose('%s took %dms', this.topic, elapsed.toFixed(1))
2828
}
2929
}
30-
31-
// /**
32-
// * Call a function f and if it fails, log the error with performance information included.
33-
// * @param action label of action to include in the error log.
34-
// * @param f action to attempt.
35-
// * @param params params that were passed to f. Defaults to empty.
36-
// * @param getCode optional mapping to extract code from error. Defaults to name of error.
37-
// * @returns result of f
38-
// */
39-
// export function withPerfLogOnFail<Result>(
40-
// action: string,
41-
// f: () => Result,
42-
// params?: object,
43-
// getCode?: (e: Error) => string
44-
// ): () => Result
45-
// export function withPerfLogOnFail<Result>(
46-
// action: string,
47-
// f: () => Promise<Result>,
48-
// params?: object,
49-
// getCode?: (e: Error) => string
50-
// ): () => Promise<Result>
51-
// export function withPerfLogOnFail<Result>(
52-
// action: string,
53-
// f: () => Result | Promise<Result>,
54-
// params?: object,
55-
// getCode?: (e: Error) => string
56-
// ) {
57-
// return function () {
58-
// const perflog = new PerfLog(action)
59-
// try {
60-
// return f()
61-
// } catch (e) {
62-
// if (e instanceof Error) {
63-
// const errWithoutStack = { ...e, name: e.name, message: e.message }
64-
// delete errWithoutStack['stack']
65-
// const timecost = perflog.elapsed().toFixed(1)
66-
// getLogger().error(
67-
// `${action} failed (time: %dms) \nparams: %O\nerror: %O`,
68-
// timecost,
69-
// params ?? {},
70-
// errWithoutStack
71-
// )
72-
// throw new ToolkitError(`${action}: ${errWithoutStack.message}`, {
73-
// code: getCode ? getCode(errWithoutStack) : errWithoutStack.name,
74-
// cause: errWithoutStack,
75-
// })
76-
// }
77-
// throw e
78-
// }
79-
// }
80-
// }

0 commit comments

Comments
 (0)