UNPKG

1.2 kBTypeScriptView Raw
1export declare type LogLevel = 'info' | 'trace' | 'debug' | 'warn' | 'error' | 'query';
2export interface RawRustLog {
3 timestamp: string;
4 level: LogLevel;
5 target: string;
6 fields: LogFields;
7}
8export interface RustLog {
9 timestamp: Date;
10 level: LogLevel;
11 target: string;
12 fields: LogFields;
13}
14export interface RustError {
15 is_panic: boolean;
16 message: string;
17 backtrace: string;
18}
19export declare function isRustError(e: any): e is RustError;
20export declare type LogFields = PanicLogFields | InfoLogFields | {
21 [key: string]: any;
22};
23export interface PanicLogFields {
24 message: 'PANIC';
25 reason: string;
26 file: string;
27 line: string;
28 column: number;
29}
30export interface InfoLogFields {
31 message: string;
32 'log.target': string;
33 'log.module_path': string;
34 'log.file': string;
35 'log.line': number;
36}
37export interface QueryLogFields {
38 query: string;
39 item_type: string;
40 params: string;
41 duration_ms: number;
42}
43export interface Log {
44 message: string;
45 level: LogLevel;
46 date: Date;
47 application: string;
48 [key: string]: string | Date;
49}
50export declare function convertLog(rustLog: RawRustLog): RustLog;