Skip to content

Commit 5c77c9b

Browse files
committed
feat(apidom-ls): add trace function
1 parent e351e9e commit 5c77c9b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/apidom-ls/src/apidom-language-types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export interface DocumentCache<T> {
3333
}
3434

3535
export enum LogLevel {
36-
DEBUG = 1,
36+
TRACE = 1,
37+
DEBUG,
3738
INFO,
3839
WARN,
3940
ERROR,

packages/apidom-ls/src/utils/utils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ export function toggleLogs(level: LogLevel) {
4545
logLevel = level;
4646
}
4747

48+
export function trace(...args: unknown[]) {
49+
if (logLevel <= LogLevel.TRACE) console.log.apply(null, args);
50+
}
51+
export function debug(...args: unknown[]) {
52+
if (logLevel <= LogLevel.DEBUG) console.debug.apply(null, args);
53+
}
4854
export function info(...args: unknown[]) {
4955
if (logLevel <= LogLevel.INFO) console.info.apply(null, args);
5056
}
5157
export function warn(...args: unknown[]) {
5258
if (logLevel <= LogLevel.WARN) console.warn.apply(null, args);
5359
}
54-
export function debug(...args: unknown[]) {
55-
if (logLevel <= LogLevel.DEBUG) console.debug.apply(null, args);
56-
}
5760
export function error(...args: unknown[]) {
5861
if (logLevel <= LogLevel.ERROR) console.error.apply(null, args);
5962
}

0 commit comments

Comments
 (0)