-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathIDBSQLLogger.ts
More file actions
34 lines (30 loc) · 1.16 KB
/
Copy pathIDBSQLLogger.ts
File metadata and controls
34 lines (30 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export interface LoggerOptions {
filepath?: string;
level?: LogLevel;
}
export default interface IDBSQLLogger {
log(level: LogLevel, message: string): void;
/**
* Optional: the logger's current level. When implemented, the SEA/kernel
* backend uses it to set the verbosity of the kernel-side (Rust) log bridge,
* so kernel logs are filtered at the same level as the driver's own logs and
* land in the same sink. Loggers that don't implement it leave the kernel
* bridge at its `info` default.
*/
getLevel?(): LogLevel;
/**
* Optional: subscribe to runtime level changes. When implemented, the
* SEA/kernel backend subscribes so a runtime `setLevel(...)` retargets the
* kernel-side log bridge too (not just the driver's own transports) — keeping
* kernel verbosity in lock-step with the driver's. Returns an unsubscribe
* function. Loggers that don't implement it still get the connect-time level;
* only *runtime* retargeting of the kernel is unavailable.
*/
onLevelChange?(listener: (level: LogLevel) => void): () => void;
}
export enum LogLevel {
error = 'error',
warn = 'warn',
info = 'info',
debug = 'debug',
}