@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 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 @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 '@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 '@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 '@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: '@horizon/node/pino',
67
- options: { apiKey: '...' }
68
- }
69
- });
70
- ```
71
-
72
- ### Winston
73
-
74
- ```typescript
75
- import { HorizonWinstonTransport } from '@horizon/node';
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
@@ -1,4 +1,2 @@
1
1
  export * from './client';
2
- export * from './pino-horizon';
3
- export * from './winston-horizon';
4
2
  export * from './middleware';
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.0",
4
- "description": "High-performance observability and logging for Node.js",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
10
- "scripts": {
11
- "build": "tsc",
12
- "prepublishOnly": "npm run build"
13
- },
14
- "keywords": [
15
- "logging",
16
- "tracing",
17
- "monitoring",
18
- "horizon",
19
- "pino",
20
- "winston"
21
- ],
22
- "author": "Horizon",
23
- "license": "MIT",
24
- "dependencies": {
25
- "axios": "^1.6.0"
26
- },
27
- "peerDependencies": {
28
- "express": "^4.18.0",
29
- "fastify": "^4.20.0",
30
- "pino": "^8.0.0",
31
- "winston": "^3.0.0"
32
- },
33
- "peerDependenciesMeta": {
34
- "express": {
35
- "optional": true
36
- },
37
- "fastify": {
38
- "optional": true
39
- },
40
- "pino": {
41
- "optional": true
42
- },
43
- "winston": {
44
- "optional": true
45
- }
46
- },
47
- "devDependencies": {
48
- "@types/express": "^4.17.0",
49
- "@types/node": "^20.0.0",
50
- "fastify": "^4.0.0",
51
- "pino": "^8.0.0",
52
- "winston-transport": "^4.0.0",
53
- "pino-abstract-transport": "^3.0.0",
54
- "typescript": "^5.0.0"
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
  }