@kisameholmes/horizon_node 1.0.0 → 1.0.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.
- package/README.md +93 -93
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/package.json +61 -55
package/README.md
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
# Horizon Node.js SDK
|
|
2
|
-
|
|
3
|
-
High-performance observability and logging for Node.js.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Features
|
|
12
|
-
|
|
13
|
-
- **Class-based Client**: Easy to use manual logging.
|
|
14
|
-
- **Batching**: Logs are buffered and sent in batches to minimize HTTP overhead.
|
|
15
|
-
- **Resilience**: Automatic exponential backoff for 5xx errors.
|
|
16
|
-
- **Transports**: Native support for Pino and Winston.
|
|
17
|
-
- **Middlewares**: One-line integration for Fastify and Express.
|
|
18
|
-
- **Error Watchdog**: Automatically catches uncaught exceptions and rejections.
|
|
19
|
-
|
|
20
|
-
## Core Usage
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
import { HorizonClient } from '@
|
|
24
|
-
|
|
25
|
-
const horizon = new HorizonClient({
|
|
26
|
-
apiKey: 'YOUR_API_KEY',
|
|
27
|
-
environment: 'production'
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Capture manual logs
|
|
31
|
-
horizon.captureLog('info', 'Process started', { version: '1.2.0' });
|
|
32
|
-
|
|
33
|
-
// Auto-capture global errors
|
|
34
|
-
horizon.autoCaptureErrors();
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Framework Integration
|
|
38
|
-
|
|
39
|
-
### Fastify
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import Fastify from 'fastify';
|
|
43
|
-
import { fastifyHorizonMiddleware } from '@
|
|
44
|
-
|
|
45
|
-
const app = Fastify();
|
|
46
|
-
app.addHook('onRequest', fastifyHorizonMiddleware(horizon));
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Express
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
import express from 'express';
|
|
53
|
-
import { expressHorizonMiddleware } from '@
|
|
54
|
-
|
|
55
|
-
const app = express();
|
|
56
|
-
app.use(expressHorizonMiddleware(horizon));
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Transports
|
|
60
|
-
|
|
61
|
-
### Pino
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
const logger = pino({
|
|
65
|
-
transport: {
|
|
66
|
-
target: '@
|
|
67
|
-
options: { apiKey: '...' }
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Winston
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
import { HorizonWinstonTransport } from '@
|
|
76
|
-
|
|
77
|
-
const logger = winston.createLogger({
|
|
78
|
-
transports: [
|
|
79
|
-
new HorizonWinstonTransport({ apiKey: '...' })
|
|
80
|
-
]
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Configuration Options
|
|
85
|
-
|
|
86
|
-
| Option | Type | Default | Description |
|
|
87
|
-
| --- | --- | --- | --- |
|
|
88
|
-
| `apiKey` | string | **Required** | Your environment API key. |
|
|
89
|
-
| `ingestUrl` | string | `https://horizon-api.bylinee.com/v1/ingest` | Horizon ingestion endpoint. |
|
|
90
|
-
| `environment` | string | `production` | Deployment environment name. |
|
|
91
|
-
| `batchSize` | number | `50` | Maximum logs per batch. |
|
|
92
|
-
| `flushInterval` | number | `2000` | Max wait time (ms) before flushing. |
|
|
93
|
-
| `maxRetries` | number | `3` | Number of retry attempts for 5xx errors. |
|
|
1
|
+
# Horizon Node.js SDK
|
|
2
|
+
|
|
3
|
+
High-performance observability and logging for Node.js.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @kisameholmes/horizon_node
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Class-based Client**: Easy to use manual logging.
|
|
14
|
+
- **Batching**: Logs are buffered and sent in batches to minimize HTTP overhead.
|
|
15
|
+
- **Resilience**: Automatic exponential backoff for 5xx errors.
|
|
16
|
+
- **Transports**: Native support for Pino and Winston.
|
|
17
|
+
- **Middlewares**: One-line integration for Fastify and Express.
|
|
18
|
+
- **Error Watchdog**: Automatically catches uncaught exceptions and rejections.
|
|
19
|
+
|
|
20
|
+
## Core Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { HorizonClient } from '@kisameholmes/horizon_node';
|
|
24
|
+
|
|
25
|
+
const horizon = new HorizonClient({
|
|
26
|
+
apiKey: 'YOUR_API_KEY',
|
|
27
|
+
environment: 'production'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Capture manual logs
|
|
31
|
+
horizon.captureLog('info', 'Process started', { version: '1.2.0' });
|
|
32
|
+
|
|
33
|
+
// Auto-capture global errors
|
|
34
|
+
horizon.autoCaptureErrors();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Framework Integration
|
|
38
|
+
|
|
39
|
+
### Fastify
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import Fastify from 'fastify';
|
|
43
|
+
import { fastifyHorizonMiddleware } from '@kisameholmes/horizon_node';
|
|
44
|
+
|
|
45
|
+
const app = Fastify();
|
|
46
|
+
app.addHook('onRequest', fastifyHorizonMiddleware(horizon));
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Express
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import express from 'express';
|
|
53
|
+
import { expressHorizonMiddleware } from '@kisameholmes/horizon_node';
|
|
54
|
+
|
|
55
|
+
const app = express();
|
|
56
|
+
app.use(expressHorizonMiddleware(horizon));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Transports
|
|
60
|
+
|
|
61
|
+
### Pino
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
const logger = pino({
|
|
65
|
+
transport: {
|
|
66
|
+
target: '@kisameholmes/horizon_node/pino',
|
|
67
|
+
options: { apiKey: '...' }
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Winston
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { HorizonWinstonTransport } from '@kisameholmes/horizon_node/winston';
|
|
76
|
+
|
|
77
|
+
const logger = winston.createLogger({
|
|
78
|
+
transports: [
|
|
79
|
+
new HorizonWinstonTransport({ apiKey: '...' })
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Configuration Options
|
|
85
|
+
|
|
86
|
+
| Option | Type | Default | Description |
|
|
87
|
+
| --- | --- | --- | --- |
|
|
88
|
+
| `apiKey` | string | **Required** | Your environment API key. |
|
|
89
|
+
| `ingestUrl` | string | `https://horizon-api.bylinee.com/v1/ingest` | Horizon ingestion endpoint. |
|
|
90
|
+
| `environment` | string | `production` | Deployment environment name. |
|
|
91
|
+
| `batchSize` | number | `50` | Maximum logs per batch. |
|
|
92
|
+
| `flushInterval` | number | `2000` | Max wait time (ms) before flushing. |
|
|
93
|
+
| `maxRetries` | number | `3` | Number of retry attempts for 5xx errors. |
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,6 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./client"), exports);
|
|
18
|
-
__exportStar(require("./pino-horizon"), exports);
|
|
19
|
-
__exportStar(require("./winston-horizon"), exports);
|
|
20
18
|
__exportStar(require("./middleware"), exports);
|
package/package.json
CHANGED
|
@@ -1,56 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kisameholmes/horizon_node",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "High-performance observability and logging for Node.js",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"
|
|
8
|
-
"dist"
|
|
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
|
-
"fastify":
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@kisameholmes/horizon_node",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "High-performance observability and logging for Node.js",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./pino": "./dist/pino-horizon.js",
|
|
10
|
+
"./winston": "./dist/winston-horizon.js",
|
|
11
|
+
"./middleware": "./dist/middleware.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"logging",
|
|
22
|
+
"tracing",
|
|
23
|
+
"monitoring",
|
|
24
|
+
"horizon",
|
|
25
|
+
"pino",
|
|
26
|
+
"winston"
|
|
27
|
+
],
|
|
28
|
+
"author": "Horizon",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"axios": "^1.6.0",
|
|
32
|
+
"pino-abstract-transport": "^3.0.0",
|
|
33
|
+
"winston-transport": "^4.9.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"express": "^4.18.0",
|
|
37
|
+
"fastify": "^4.20.0",
|
|
38
|
+
"pino": "^8.0.0",
|
|
39
|
+
"winston": "^3.0.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependenciesMeta": {
|
|
42
|
+
"express": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"fastify": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"pino": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"winston": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/express": "^4.17.0",
|
|
57
|
+
"@types/node": "^20.0.0",
|
|
58
|
+
"fastify": "^4.0.0",
|
|
59
|
+
"pino": "^8.0.0",
|
|
60
|
+
"typescript": "^5.0.0"
|
|
61
|
+
}
|
|
56
62
|
}
|