forked from olofd/react-native-device-log
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdebug-service.d.ts
84 lines (84 loc) · 3.09 KB
/
debug-service.d.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { NetInfoState } from '@react-native-community/netinfo';
import LogRow from './LogRow';
import BaseDataWriter from './data-writers/BaseDataWriter';
declare type Options = {
color?: string;
colors?: any;
};
declare type LogLevel = {
0: "silly";
1: "trace";
2: "debug";
3: "info";
4: "success";
5: "log";
6: "warn";
7: "error";
8: "fatal";
};
declare type LogLevelId = keyof LogLevel;
export declare type LogLevelName = LogLevel[LogLevelId];
export declare type AdditionalLogLevelNames = 'start-timer' | 'end-timer' | 'RNFatal' | 'RNError' | 'seperator';
interface DebugServiceOptions {
colors?: any;
logToConsole?: boolean;
logToConsoleMethod?: string;
logToConsoleFunc?: Function;
logRNErrors?: boolean;
maxNumberToRender?: number;
maxNumberToPersist?: number;
rowInsertDebounceMs?: number;
logAppState?: boolean;
logConnection?: boolean;
disableLevelToConsole?: string[];
appendToLogRow?: Function;
customDataWriter?: BaseDataWriter;
minLevel?: LogLevelName;
}
declare class DebugService {
logRows: LogRow[];
store: BaseDataWriter;
options: DebugServiceOptions;
listners: Function[];
initPromise?: Promise<LogRow[]>;
debouncedInsert?: Function;
rowsToInsert?: LogRow[];
appStartRendered: boolean;
connectionHasBeenEstablished: boolean;
hasBeenDisconnected: boolean;
private readonly _logLevels;
private readonly _levelMap;
constructor(options?: DebugServiceOptions);
_handleConnectivityTypeChange(connectionInfo: NetInfoState): void;
_handleAppStateChange(currentAppState: string): void;
setupRNErrorLogging(): void;
init(storageAdapter: any, options: DebugServiceOptions): Promise<void>;
insertAppStartMessage(): Promise<void>;
insertStoreRows(rows: LogRow[]): Promise<void>;
_initalGet(): Promise<void>;
sortLogRows(): void;
_getAndEmit(): Promise<void>;
stopTimer(name: string): void;
startTimer(name: string): Promise<void>;
logTime(name: string): Promise<void>;
clear(): Promise<void>;
log(...logRows: string[]): Promise<void>;
debug(...logRows: string[]): Promise<void>;
info(...logRows: string[]): Promise<void>;
error(...logRows: string[]): Promise<void>;
fatal(...logRows: string[]): Promise<void>;
success(...logRows: string[]): Promise<void>;
rnerror(fatal: boolean, message: string, stackTrace: any): Promise<void>;
seperator(name: string): Promise<void>;
getColorForLogLevel(level: string): any;
isAdditionalLogLevel(level: LogLevelName | AdditionalLogLevelNames): level is AdditionalLogLevelNames;
_log(level: LogLevelName | AdditionalLogLevelNames, options?: Options, ...logRows: string[]): Promise<void>;
logToConsole(level: string, color: string, ...logRows: string[]): void;
_parseDataToString(data: string | any): string;
_appendToLog(logRows: LogRow[]): Promise<void>;
onDebugRowsChanged(cb: Function): Function;
emitDebugRowsChanged(data: LogRow[]): void;
getEmittableData(rows: LogRow[]): LogRow[];
}
declare const _default: DebugService;
export default _default;