@onekeyfe/react-native-native-logger 3.0.162 → 3.0.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/package.json +6 -5
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @onekeyfe/react-native-native-logger
|
|
2
|
+
|
|
3
|
+
Native file logging for OneKey React Native applications on iOS and Android.
|
|
4
|
+
The JavaScript interface writes messages, enumerates log files and clears stored
|
|
5
|
+
logs. Native code owns log formatting, rotation and repeat-message handling.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
yarn add @onekeyfe/react-native-native-logger react-native-nitro-modules
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Install the application's iOS pods and rebuild the native application after
|
|
14
|
+
adding the package. This module requires the Nitro native runtime; installing
|
|
15
|
+
the JavaScript package alone does not register its native implementation.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { NativeLogger } from '@onekeyfe/react-native-native-logger';
|
|
21
|
+
|
|
22
|
+
NativeLogger.write(1, 'Application started');
|
|
23
|
+
NativeLogger.flushPendingRepeat();
|
|
24
|
+
|
|
25
|
+
const directory = NativeLogger.getLogDirectory();
|
|
26
|
+
const files = await NativeLogger.getLogFilePaths();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
| Method | Purpose |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `write(level, msg)` | Write a message: 0 debug, 1 info, 2 warning, 3 error. |
|
|
34
|
+
| `flushPendingRepeat()` | Flush a pending repeated-message summary before export. |
|
|
35
|
+
| `getLogDirectory()` | Return the native log directory. |
|
|
36
|
+
| `getLogFilePaths()` | List native log files asynchronously. |
|
|
37
|
+
| `deleteLogFiles()` | Clear the native log files. |
|
|
38
|
+
|
|
39
|
+
On iOS, `getLogFilePaths()` returns filenames, rather than absolute paths; combine
|
|
40
|
+
them with the directory when exporting. Clearing logs can truncate the active
|
|
41
|
+
file instead of removing it. Callers own export and upload, and should avoid
|
|
42
|
+
writing credentials or other private values into messages.
|
|
43
|
+
|
|
44
|
+
The current bridge is defined in [src/NativeLogger.nitro.ts](src/NativeLogger.nitro.ts).
|
|
45
|
+
Native behavior is implemented in the package's `ios` and `android` directories.
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
MIT.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-logger",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.165",
|
|
4
|
+
"description": "Native file logging and log export support for OneKey on iOS and Android",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -50,14 +50,15 @@
|
|
|
50
50
|
],
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
|
53
|
-
"url": "git+https://github.com/OneKeyHQ/app-modules
|
|
53
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
54
|
+
"directory": "native-modules/native-logger"
|
|
54
55
|
},
|
|
55
56
|
"author": "onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
56
57
|
"license": "MIT",
|
|
57
58
|
"bugs": {
|
|
58
|
-
"url": "https://github.com/OneKeyHQ/app-modules/
|
|
59
|
+
"url": "https://github.com/OneKeyHQ/app-modules/issues"
|
|
59
60
|
},
|
|
60
|
-
"homepage": "https://github.com/OneKeyHQ/app-modules/native-logger#readme",
|
|
61
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/native-logger#readme",
|
|
61
62
|
"publishConfig": {
|
|
62
63
|
"registry": "https://registry.npmjs.org/"
|
|
63
64
|
},
|