@logmint/sdk 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/README.md +35 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,15 +1,18 @@
1
1
  # Hey there!
2
2
  ## Welcome to LogMint SDK
3
+ Watch full demo <a href="https://www.youtube.com/watch?v=FHgbC97xbY0">here</a>
3
4
 
4
5
  This SDK will help you log events directly on our cloud or in your local database just with the help of a few lines of code.
6
+ <br/>
7
+ <img width="600" height="440" alt="674_1x_shots_so" src="https://github.com/user-attachments/assets/8bebac43-4438-4937-84fe-f1b107857a50" />
5
8
 
6
9
  ### Local Setup
7
10
  - Install package using
8
- `npm install @logmint/audit`
11
+ `npm install @logmint/sdk`
9
12
 
10
13
  - For local setup, just initailize and connect to your database:
11
14
  ```js
12
- const { init, log } = require("@logmint/audit");
15
+ const { init, log } = require("@logmint/sdk");
13
16
  const { Pool } = require("pg");
14
17
 
15
18
  await init({
@@ -52,21 +55,25 @@ await log({
52
55
  metadata: { old_column: "old", new_column: "new" },
53
56
  });
54
57
  ```
58
+ You can visualize the audit logs:
59
+
60
+ <img width="660" height="440" alt="459_1x_shots_so" src="https://github.com/user-attachments/assets/eb00495d-17be-4466-a8dc-0a69372c4fa0" />
61
+
55
62
  ### Cloud Setup
56
63
  - Install package using
57
- `npm install @logmint/audit`
64
+ `npm install @logmint/sdk`
58
65
  ```js
59
- const { init, log, flush } = require("@logmint/audit");
66
+ const { init, log, flush, addMetric } = require("@logmint/sdk");
60
67
 
61
68
  await init({
62
69
  mode: "cloud",
63
70
  apiKey: "YOUR_API_KEY",
64
71
  secretKey: "YOUR_SECRET_KEY",
72
+ url: "https://api.getlogmint.com"
65
73
  });
66
74
  ```
67
75
 
68
76
  ### Log events
69
- In place of URL, use `https://api.getlogmint.com`
70
77
  ```js
71
78
  await log({
72
79
  event_type: "user.paid.first.order",
@@ -75,13 +82,32 @@ await log({
75
82
  resource_id: "#1",
76
83
  resource_type: "mobile app",
77
84
  metadata: { old_column: "old", new_column: "new" },
78
- }, `<URL>`);
85
+ });
79
86
  ```
80
87
  If events fail to get logged, it will automatically get pushed to redis. You'll have to flush it out.(Recommended once a week).
81
- In place of URL, use `https://api.getlogmint.com`
82
88
  ```js
83
- const { flush } = require("@logmint/audit");
89
+ const { flush } = require("@logmint/sdk");
84
90
 
85
- await flush(`<URL>`);
91
+ await flush();
92
+ ```
93
+ ### Add metrics
94
+ ```js
95
+ await addMetric({
96
+ name:"user.signup",
97
+ value:1,
98
+ type:"counter",
99
+ tags:{env:"prod"}
100
+ })
86
101
  ```
102
+ Once you have added the metrics, you can visualize them on the app and even create widgets:
103
+ <img width="660" height="440" alt="320_1x_shots_so" src="https://github.com/user-attachments/assets/106e61ff-824e-486f-aeea-170c9ae0a427" />
104
+ <br/>
105
+ <img width="660" height="440" alt="732_1x_shots_so" src="https://github.com/user-attachments/assets/d1ae78a6-e50c-41f9-9271-d7b9de884286" />
106
+
107
+ ### Application logs
108
+ Application logs are automatically captured!
109
+
110
+ <img width="660" height="440" alt="725_1x_shots_so" src="https://github.com/user-attachments/assets/8c2a9254-fc17-4469-b160-c7614e889d6c" />
111
+
112
+
87
113
  #### Contact us: support@getlogmint.com
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logmint/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "LogMint SDK for sending audit logs, metrics, application logs",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",