@avss-tech/logger 1.0.3 → 1.0.5
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 +45 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,9 @@ const logger = new AVSLogger({
|
|
|
28
28
|
project: 'my-app',
|
|
29
29
|
apiKey: 'your-api-key',
|
|
30
30
|
endpoint: 'http://logging-service:4000/logs',
|
|
31
|
+
onFatalError: (error) => {
|
|
32
|
+
console.error('AVS Logger Fatal Error:', error);
|
|
33
|
+
},
|
|
31
34
|
});
|
|
32
35
|
|
|
33
36
|
// Log message
|
|
@@ -151,6 +154,48 @@ console.log(stats);
|
|
|
151
154
|
logger.resetStatistics();
|
|
152
155
|
```
|
|
153
156
|
|
|
157
|
+
### HTTP Endpoints (Server API) 🔗
|
|
158
|
+
|
|
159
|
+
Below are the server-side HTTP endpoints the SDK interacts with. Use these `curl` examples for testing; replace `<API_KEY>` with your API key and `<PROJECT>` with your project identifier.
|
|
160
|
+
|
|
161
|
+
- **Search logs** (query by date, level, user, project)
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
curl --location 'https://logs.avsstech.in/logs/search?startDate=2026-01-01&endDate=2026-01-31&level=info&userId=&project=esign-saas' \
|
|
165
|
+
--header 'x-api-key: <API_KEY>'
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
SDK: `await logger.search({ startDate: '2026-01-01', endDate: '2026-01-31', level: 'info', userId: '', project: 'esign-saas' })`
|
|
169
|
+
|
|
170
|
+
- **Audit logs** (get recent audit entries for a project)
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
curl --location 'https://logs.avsstech.in/logs/audit/esign-saas?limit=50' \
|
|
174
|
+
--header 'x-api-key: <API_KEY>'
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
SDK: `await logger.getAuditLogs(50, 'esign-saas')`
|
|
178
|
+
|
|
179
|
+
- **Verify logs** (verify integrity/status for a project)
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
curl --location 'https://logs.avsstech.in/logs/verify/esign-saas' \
|
|
183
|
+
--header 'x-api-key: <API_KEY>'
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
SDK: `await logger.verify('esign-saas')`
|
|
187
|
+
|
|
188
|
+
- **Statistics** (get aggregated stats for a project)
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
curl --location 'https://logs.avsstech.in/logs/statistics/esign-saas' \
|
|
192
|
+
--header 'x-api-key: <API_KEY>'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
SDK: `await logger.getStatisticsForProject('esign-saas')`
|
|
196
|
+
|
|
197
|
+
All endpoints require the `x-api-key` header for authentication and accept `project` either as a path or query parameter as shown above.
|
|
198
|
+
|
|
154
199
|
## Error Handling
|
|
155
200
|
|
|
156
201
|
```typescript
|