@orgloop/logger-syslog 0.1.0

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OrgLoop contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @orgloop/logger-syslog — registration entry point.
3
+ */
4
+ import type { LoggerRegistration } from '@orgloop/sdk';
5
+ export declare function register(): LoggerRegistration;
6
+ export { SyslogLogger } from './syslog-logger.js';
7
+ export { formatRfc5424, getSeverity, UdpTransport, TcpTransport, UnixTransport, } from './syslog-logger.js';
8
+ export type { SyslogTransport, SyslogLoggerConfig } from './syslog-logger.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGvD,wBAAgB,QAAQ,IAAI,kBAAkB,CAqE7C;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACN,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @orgloop/logger-syslog — registration entry point.
3
+ */
4
+ import { SyslogLogger } from './syslog-logger.js';
5
+ export function register() {
6
+ return {
7
+ id: 'syslog',
8
+ logger: SyslogLogger,
9
+ configSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ transport: {
13
+ type: 'string',
14
+ enum: ['udp', 'tcp', 'unix'],
15
+ description: 'Syslog transport protocol.',
16
+ default: 'udp',
17
+ },
18
+ host: {
19
+ type: 'string',
20
+ description: 'Syslog server host.',
21
+ default: '127.0.0.1',
22
+ },
23
+ port: {
24
+ type: 'number',
25
+ description: 'Syslog server port.',
26
+ default: 514,
27
+ },
28
+ path: {
29
+ type: 'string',
30
+ description: 'Unix socket path (for transport: unix).',
31
+ default: '/dev/log',
32
+ },
33
+ facility: {
34
+ type: 'string',
35
+ enum: [
36
+ 'kern',
37
+ 'user',
38
+ 'mail',
39
+ 'daemon',
40
+ 'auth',
41
+ 'syslog',
42
+ 'lpr',
43
+ 'news',
44
+ 'uucp',
45
+ 'cron',
46
+ 'authpriv',
47
+ 'ftp',
48
+ 'local0',
49
+ 'local1',
50
+ 'local2',
51
+ 'local3',
52
+ 'local4',
53
+ 'local5',
54
+ 'local6',
55
+ 'local7',
56
+ ],
57
+ description: 'Syslog facility name.',
58
+ default: 'local0',
59
+ },
60
+ app_name: {
61
+ type: 'string',
62
+ description: 'APP-NAME field in syslog messages.',
63
+ default: 'orgloop',
64
+ },
65
+ include_structured_data: {
66
+ type: 'boolean',
67
+ description: 'Include [orgloop@49999 ...] structured data element.',
68
+ default: true,
69
+ },
70
+ },
71
+ additionalProperties: false,
72
+ },
73
+ };
74
+ }
75
+ export { SyslogLogger } from './syslog-logger.js';
76
+ export { formatRfc5424, getSeverity, UdpTransport, TcpTransport, UnixTransport, } from './syslog-logger.js';
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,UAAU,QAAQ;IACvB,OAAO;QACN,EAAE,EAAE,QAAQ;QACZ,MAAM,EAAE,YAAY;QACpB,YAAY,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACX,SAAS,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC;oBAC5B,WAAW,EAAE,4BAA4B;oBACzC,OAAO,EAAE,KAAK;iBACd;gBACD,IAAI,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qBAAqB;oBAClC,OAAO,EAAE,WAAW;iBACpB;gBACD,IAAI,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qBAAqB;oBAClC,OAAO,EAAE,GAAG;iBACZ;gBACD,IAAI,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,yCAAyC;oBACtD,OAAO,EAAE,UAAU;iBACnB;gBACD,QAAQ,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE;wBACL,MAAM;wBACN,MAAM;wBACN,MAAM;wBACN,QAAQ;wBACR,MAAM;wBACN,QAAQ;wBACR,KAAK;wBACL,MAAM;wBACN,MAAM;wBACN,MAAM;wBACN,UAAU;wBACV,KAAK;wBACL,QAAQ;wBACR,QAAQ;wBACR,QAAQ;wBACR,QAAQ;wBACR,QAAQ;wBACR,QAAQ;wBACR,QAAQ;wBACR,QAAQ;qBACR;oBACD,WAAW,EAAE,uBAAuB;oBACpC,OAAO,EAAE,QAAQ;iBACjB;gBACD,QAAQ,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,oCAAoC;oBACjD,OAAO,EAAE,SAAS;iBAClB;gBACD,uBAAuB,EAAE;oBACxB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,sDAAsD;oBACnE,OAAO,EAAE,IAAI;iBACb;aACD;YACD,oBAAoB,EAAE,KAAK;SAC3B;KACD,CAAC;AACH,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACN,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,GACb,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Syslog logger — RFC 5424 formatted messages for enterprise/unix deployments.
3
+ *
4
+ * Supports UDP (fire-and-forget), TCP (reliable, newline-delimited),
5
+ * and Unix socket transports. Zero external dependencies.
6
+ */
7
+ import type { LogEntry, LogPhase, Logger } from '@orgloop/sdk';
8
+ /** Get severity for a phase, with optional fatal upgrade */
9
+ export declare function getSeverity(phase: LogPhase, metadata?: Record<string, unknown>): number;
10
+ /**
11
+ * Build an RFC 5424 syslog message.
12
+ *
13
+ * Format: <PRI>VERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP MSGID SP SD SP MSG
14
+ */
15
+ export declare function formatRfc5424(entry: LogEntry, facility: number, appName: string, hostName: string, includeStructuredData: boolean): string;
16
+ export interface SyslogTransport {
17
+ send(message: string): void;
18
+ close(): Promise<void>;
19
+ }
20
+ export declare class UdpTransport implements SyslogTransport {
21
+ private socket;
22
+ private host;
23
+ private port;
24
+ constructor(host: string, port: number);
25
+ send(message: string): void;
26
+ close(): Promise<void>;
27
+ }
28
+ export declare class TcpTransport implements SyslogTransport {
29
+ private socket;
30
+ private host;
31
+ private port;
32
+ private connecting;
33
+ private closed;
34
+ private buffer;
35
+ constructor(host: string, port: number);
36
+ private connect;
37
+ private writeToSocket;
38
+ send(message: string): void;
39
+ close(): Promise<void>;
40
+ }
41
+ export declare class UnixTransport implements SyslogTransport {
42
+ private socket;
43
+ private socketPath;
44
+ private connecting;
45
+ private closed;
46
+ private buffer;
47
+ constructor(socketPath: string);
48
+ private connect;
49
+ private writeToSocket;
50
+ send(message: string): void;
51
+ close(): Promise<void>;
52
+ }
53
+ export interface SyslogLoggerConfig {
54
+ transport?: 'udp' | 'tcp' | 'unix';
55
+ host?: string;
56
+ port?: number;
57
+ path?: string;
58
+ facility?: string;
59
+ app_name?: string;
60
+ include_structured_data?: boolean;
61
+ /** Internal: override transport for testing */
62
+ _transport?: SyslogTransport;
63
+ }
64
+ export declare class SyslogLogger implements Logger {
65
+ readonly id = "syslog";
66
+ private transport;
67
+ private facility;
68
+ private appName;
69
+ private hostName;
70
+ private includeStructuredData;
71
+ init(config: Record<string, unknown>): Promise<void>;
72
+ log(entry: LogEntry): Promise<void>;
73
+ flush(): Promise<void>;
74
+ shutdown(): Promise<void>;
75
+ }
76
+ //# sourceMappingURL=syslog-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syslog-logger.d.ts","sourceRoot":"","sources":["../src/syslog-logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AA+C/D,4DAA4D;AAC5D,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAOvF;AAYD;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE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UrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAW5B;AAID,MAAM,WAAW,kBAAkB;IAClC,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,+CAA+C;IAC/C,UAAU,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,qBAAa,YAAa,YAAW,MAAM;IAC1C,QAAQ,CAAC,EAAE,YAAY;IACvB,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,qBAAqB,CAAQ;IAE/B,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCpD,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAM/B"}
@@ -0,0 +1,357 @@
1
+ /**
2
+ * Syslog logger — RFC 5424 formatted messages for enterprise/unix deployments.
3
+ *
4
+ * Supports UDP (fire-and-forget), TCP (reliable, newline-delimited),
5
+ * and Unix socket transports. Zero external dependencies.
6
+ */
7
+ import { createSocket } from 'node:dgram';
8
+ import { createConnection } from 'node:net';
9
+ import { hostname } from 'node:os';
10
+ // ─── RFC 5424 Facilities ─────────────────────────────────────────────────────
11
+ const FACILITY_MAP = {
12
+ kern: 0,
13
+ user: 1,
14
+ mail: 2,
15
+ daemon: 3,
16
+ auth: 4,
17
+ syslog: 5,
18
+ lpr: 6,
19
+ news: 7,
20
+ uucp: 8,
21
+ cron: 9,
22
+ authpriv: 10,
23
+ ftp: 11,
24
+ local0: 16,
25
+ local1: 17,
26
+ local2: 18,
27
+ local3: 19,
28
+ local4: 20,
29
+ local5: 21,
30
+ local6: 22,
31
+ local7: 23,
32
+ };
33
+ // ─── RFC 5424 Severity Mapping ───────────────────────────────────────────────
34
+ /** Map OrgLoop phases to RFC 5424 severity levels */
35
+ const PHASE_SEVERITY = {
36
+ 'system.error': 3, // Error (may be upgraded to Critical via metadata)
37
+ 'deliver.failure': 3, // Error
38
+ 'transform.error': 4, // Warning
39
+ 'deliver.retry': 4, // Warning
40
+ 'deliver.success': 6, // Informational
41
+ 'deliver.attempt': 6, // Informational
42
+ 'route.match': 6, // Informational
43
+ 'transform.pass': 6, // Informational
44
+ 'transform.drop': 6, // Informational
45
+ 'system.start': 6, // Informational
46
+ 'system.stop': 6, // Informational
47
+ 'source.emit': 7, // Debug
48
+ 'transform.start': 7, // Debug
49
+ 'route.no_match': 7, // Debug
50
+ };
51
+ /** Get severity for a phase, with optional fatal upgrade */
52
+ export function getSeverity(phase, metadata) {
53
+ const base = PHASE_SEVERITY[phase] ?? 6;
54
+ // Upgrade system.error to Critical if fatal flag is set
55
+ if (phase === 'system.error' && metadata?.fatal === true) {
56
+ return 2;
57
+ }
58
+ return base;
59
+ }
60
+ // ─── RFC 5424 Message Formatting ─────────────────────────────────────────────
61
+ /**
62
+ * Escape structured data param values per RFC 5424 section 6.3.3:
63
+ * `"`, `\`, and `]` must be escaped with backslash.
64
+ */
65
+ function escapeSDValue(value) {
66
+ return value.replace(/["\\\]]/g, (ch) => `\\${ch}`);
67
+ }
68
+ /**
69
+ * Build an RFC 5424 syslog message.
70
+ *
71
+ * Format: <PRI>VERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP MSGID SP SD SP MSG
72
+ */
73
+ export function formatRfc5424(entry, facility, appName, hostName, includeStructuredData) {
74
+ const severity = getSeverity(entry.phase, entry.metadata);
75
+ const pri = facility * 8 + severity;
76
+ const version = 1;
77
+ const timestamp = entry.timestamp || new Date().toISOString();
78
+ const procId = String(process.pid);
79
+ const msgId = entry.phase;
80
+ // Build structured data
81
+ let sd = '-';
82
+ if (includeStructuredData) {
83
+ const params = [];
84
+ if (entry.event_id)
85
+ params.push(`event_id="${escapeSDValue(entry.event_id)}"`);
86
+ if (entry.trace_id)
87
+ params.push(`trace_id="${escapeSDValue(entry.trace_id)}"`);
88
+ if (entry.source)
89
+ params.push(`source="${escapeSDValue(entry.source)}"`);
90
+ if (entry.event_type)
91
+ params.push(`event_type="${escapeSDValue(entry.event_type)}"`);
92
+ if (entry.target)
93
+ params.push(`target="${escapeSDValue(entry.target)}"`);
94
+ if (entry.route)
95
+ params.push(`route="${escapeSDValue(entry.route)}"`);
96
+ if (entry.transform)
97
+ params.push(`transform="${escapeSDValue(entry.transform)}"`);
98
+ if (entry.duration_ms !== undefined)
99
+ params.push(`duration_ms="${entry.duration_ms}"`);
100
+ if (entry.error)
101
+ params.push(`error="${escapeSDValue(entry.error)}"`);
102
+ if (params.length > 0) {
103
+ // Use Private Enterprise Number (PEN) range — 49999 is in the example range
104
+ sd = `[orgloop@49999 ${params.join(' ')}]`;
105
+ }
106
+ }
107
+ // Build human-readable message
108
+ const msgParts = [entry.phase];
109
+ if (entry.source)
110
+ msgParts.push(entry.source);
111
+ if (entry.event_type)
112
+ msgParts.push(entry.event_type);
113
+ if (entry.event_id)
114
+ msgParts.push(entry.event_id);
115
+ if (entry.error)
116
+ msgParts.push(`error="${entry.error}"`);
117
+ const msg = msgParts.join(' ');
118
+ return `<${pri}>${version} ${timestamp} ${hostName} ${appName} ${procId} ${msgId} ${sd} ${msg}`;
119
+ }
120
+ // ─── UDP Transport ───────────────────────────────────────────────────────────
121
+ export class UdpTransport {
122
+ socket;
123
+ host;
124
+ port;
125
+ constructor(host, port) {
126
+ this.host = host;
127
+ this.port = port;
128
+ this.socket = createSocket('udp4');
129
+ // Unref so the socket doesn't keep the process alive
130
+ this.socket.unref();
131
+ }
132
+ send(message) {
133
+ const buf = Buffer.from(message, 'utf-8');
134
+ this.socket.send(buf, 0, buf.length, this.port, this.host, () => {
135
+ // Fire-and-forget — errors are silently ignored
136
+ });
137
+ }
138
+ async close() {
139
+ return new Promise((resolve) => {
140
+ try {
141
+ this.socket.close(() => resolve());
142
+ }
143
+ catch {
144
+ resolve();
145
+ }
146
+ });
147
+ }
148
+ }
149
+ // ─── TCP Transport ───────────────────────────────────────────────────────────
150
+ export class TcpTransport {
151
+ socket = null;
152
+ host;
153
+ port;
154
+ connecting = false;
155
+ closed = false;
156
+ buffer = [];
157
+ constructor(host, port) {
158
+ this.host = host;
159
+ this.port = port;
160
+ this.connect();
161
+ }
162
+ connect() {
163
+ if (this.closed || this.connecting)
164
+ return;
165
+ this.connecting = true;
166
+ const socket = createConnection({ host: this.host, port: this.port }, () => {
167
+ this.connecting = false;
168
+ this.socket = socket;
169
+ // Flush any buffered messages
170
+ for (const msg of this.buffer.splice(0)) {
171
+ this.writeToSocket(msg);
172
+ }
173
+ });
174
+ socket.setKeepAlive(true);
175
+ socket.unref();
176
+ socket.on('error', () => {
177
+ // Reconnect on error
178
+ this.socket = null;
179
+ this.connecting = false;
180
+ if (!this.closed) {
181
+ setTimeout(() => this.connect(), 1000);
182
+ }
183
+ });
184
+ socket.on('close', () => {
185
+ this.socket = null;
186
+ this.connecting = false;
187
+ if (!this.closed) {
188
+ setTimeout(() => this.connect(), 1000);
189
+ }
190
+ });
191
+ }
192
+ writeToSocket(message) {
193
+ try {
194
+ // RFC 5425: TCP syslog uses newline-delimited messages
195
+ this.socket?.write(`${message}\n`);
196
+ }
197
+ catch {
198
+ // Silently drop on write failure
199
+ }
200
+ }
201
+ send(message) {
202
+ if (this.socket && !this.socket.destroyed) {
203
+ this.writeToSocket(message);
204
+ }
205
+ else {
206
+ // Buffer during reconnection (bounded to prevent memory leak)
207
+ if (this.buffer.length < 1000) {
208
+ this.buffer.push(message);
209
+ }
210
+ }
211
+ }
212
+ async close() {
213
+ this.closed = true;
214
+ this.buffer.length = 0;
215
+ return new Promise((resolve) => {
216
+ if (this.socket) {
217
+ this.socket.end(() => resolve());
218
+ }
219
+ else {
220
+ resolve();
221
+ }
222
+ });
223
+ }
224
+ }
225
+ // ─── Unix Socket Transport ───────────────────────────────────────────────────
226
+ export class UnixTransport {
227
+ socket = null;
228
+ socketPath;
229
+ connecting = false;
230
+ closed = false;
231
+ buffer = [];
232
+ constructor(socketPath) {
233
+ this.socketPath = socketPath;
234
+ this.connect();
235
+ }
236
+ connect() {
237
+ if (this.closed || this.connecting)
238
+ return;
239
+ this.connecting = true;
240
+ const socket = createConnection({ path: this.socketPath }, () => {
241
+ this.connecting = false;
242
+ this.socket = socket;
243
+ for (const msg of this.buffer.splice(0)) {
244
+ this.writeToSocket(msg);
245
+ }
246
+ });
247
+ socket.unref();
248
+ socket.on('error', () => {
249
+ this.socket = null;
250
+ this.connecting = false;
251
+ if (!this.closed) {
252
+ setTimeout(() => this.connect(), 1000);
253
+ }
254
+ });
255
+ socket.on('close', () => {
256
+ this.socket = null;
257
+ this.connecting = false;
258
+ if (!this.closed) {
259
+ setTimeout(() => this.connect(), 1000);
260
+ }
261
+ });
262
+ }
263
+ writeToSocket(message) {
264
+ try {
265
+ this.socket?.write(`${message}\n`);
266
+ }
267
+ catch {
268
+ // Silently drop on write failure
269
+ }
270
+ }
271
+ send(message) {
272
+ if (this.socket && !this.socket.destroyed) {
273
+ this.writeToSocket(message);
274
+ }
275
+ else {
276
+ if (this.buffer.length < 1000) {
277
+ this.buffer.push(message);
278
+ }
279
+ }
280
+ }
281
+ async close() {
282
+ this.closed = true;
283
+ this.buffer.length = 0;
284
+ return new Promise((resolve) => {
285
+ if (this.socket) {
286
+ this.socket.end(() => resolve());
287
+ }
288
+ else {
289
+ resolve();
290
+ }
291
+ });
292
+ }
293
+ }
294
+ export class SyslogLogger {
295
+ id = 'syslog';
296
+ transport = null;
297
+ facility = 16; // local0
298
+ appName = 'orgloop';
299
+ hostName = hostname();
300
+ includeStructuredData = true;
301
+ async init(config) {
302
+ const cfg = config;
303
+ // Parse facility
304
+ if (cfg.facility) {
305
+ const num = FACILITY_MAP[cfg.facility];
306
+ if (num !== undefined) {
307
+ this.facility = num;
308
+ }
309
+ }
310
+ if (cfg.app_name)
311
+ this.appName = cfg.app_name;
312
+ if (cfg.include_structured_data !== undefined) {
313
+ this.includeStructuredData = cfg.include_structured_data;
314
+ }
315
+ // Use injected transport if provided (for testing)
316
+ if (cfg._transport) {
317
+ this.transport = cfg._transport;
318
+ return;
319
+ }
320
+ // Create transport
321
+ const transportType = cfg.transport ?? 'udp';
322
+ const host = cfg.host ?? '127.0.0.1';
323
+ const port = cfg.port ?? 514;
324
+ switch (transportType) {
325
+ case 'tcp':
326
+ this.transport = new TcpTransport(host, port);
327
+ break;
328
+ case 'unix':
329
+ this.transport = new UnixTransport(cfg.path ?? '/dev/log');
330
+ break;
331
+ default:
332
+ this.transport = new UdpTransport(host, port);
333
+ break;
334
+ }
335
+ }
336
+ async log(entry) {
337
+ try {
338
+ if (!this.transport)
339
+ return;
340
+ const message = formatRfc5424(entry, this.facility, this.appName, this.hostName, this.includeStructuredData);
341
+ this.transport.send(message);
342
+ }
343
+ catch {
344
+ // Loggers must not throw
345
+ }
346
+ }
347
+ async flush() {
348
+ // UDP is fire-and-forget; TCP/Unix writes are synchronous from our perspective
349
+ }
350
+ async shutdown() {
351
+ if (this.transport) {
352
+ await this.transport.close();
353
+ this.transport = null;
354
+ }
355
+ }
356
+ }
357
+ //# sourceMappingURL=syslog-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syslog-logger.js","sourceRoot":"","sources":["../src/syslog-logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA4B,YAAY,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAA4B,gBAAgB,EAAE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AAI,WAAW,CAAC;QACrC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC;QAE7B,QAAQ,aAAa,EAAE,CAAC;YACvB,KAAK,KAAK;gBACT,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC9C,MAAM;YACP,KAAK,MAAM;gBACV,IAAI,CAAC,SAAS,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,IAAI,UAAU,CAAC,CAAC;gBAC3D,MAAM;YACP;gBACC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC9C,MAAM;QACR,CAAC;IACF,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,KAAe;QACxB,IAAI,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO;YAE5B,MAAM,OAAO,GAAG,aAAa,CAC5B,KAAK,EACL,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,qBAAqB,CAC1B,CAAC;YAEF,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QAAC,MAAM,CAAC;YACR,yBAAyB;QAC1B,CAAC;IACF,CAAC;IAED,KAAK,CAAC,KAAK;QACV,+EAA+E;IAChF,CAAC;IAED,KAAK,CAAC,QAAQ;QACb,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACvB,CAAC;IACF,CAAC;CACD"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@orgloop/logger-syslog",
3
+ "version": "0.1.0",
4
+ "description": "OrgLoop syslog logger — RFC 5424 for enterprise/unix deployments",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "dependencies": {
9
+ "@orgloop/sdk": "0.1.0"
10
+ },
11
+ "orgloop": {
12
+ "type": "logger",
13
+ "id": "syslog"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "license": "MIT",
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "clean": "rm -rf dist",
25
+ "typecheck": "tsc --noEmit",
26
+ "test": "vitest run"
27
+ }
28
+ }