logquill 0.1.1 → 0.2.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/dist/index.d.cts CHANGED
@@ -1,3 +1,979 @@
1
- declare const VERSION = "0.1.0";
1
+ /** Log levels, shared by name and numeric weight with the logquill-python contract. */
2
+ declare enum Level {
3
+ TRACE = 5,
4
+ DEBUG = 10,
5
+ INFO = 20,
6
+ WARN = 30,
7
+ ERROR = 40,
8
+ FATAL = 50
9
+ }
10
+ /** A level given as a `Level`, a level name (any case), or its numeric weight. */
11
+ type LevelInput = Level | number | string;
12
+ /** The level's name, e.g. `levelName(Level.INFO) === "INFO"`. */
13
+ declare function levelName(level: Level): string;
14
+ /** Normalize a level given as a `Level`, level name, or numeric weight. Throws if unknown. */
15
+ declare function parseLevel(level: LevelInput): Level;
2
16
 
3
- export { VERSION };
17
+ /** The cross-language record shape shared with logquill-python. */
18
+ interface LogRecord {
19
+ timestamp: string;
20
+ level: string;
21
+ logger: string;
22
+ message: string;
23
+ meta: Record<string, unknown>;
24
+ }
25
+ /** ISO8601 UTC timestamp with millisecond precision, matching Python's `utc_timestamp()`. */
26
+ declare function utcTimestamp(): string;
27
+ declare function createRecord(params: {
28
+ level: Level;
29
+ logger: string;
30
+ message: string;
31
+ meta: Record<string, unknown>;
32
+ }): LogRecord;
33
+
34
+ /** `format(record) -> string`, per the transport contract shared with logquill-python. */
35
+ interface Formatter {
36
+ format(record: LogRecord): string;
37
+ }
38
+ /** Serializes a record to the canonical JSON line shape. */
39
+ declare class JSONFormatter implements Formatter {
40
+ format(record: LogRecord): string;
41
+ }
42
+
43
+ /**
44
+ * The plugin pipeline hooks, matching the Python hook names: `beforeLog`,
45
+ * `afterLog`, `onError`. All hooks are optional — implement only what you need.
46
+ * A hook that throws cannot crash logging: the pipeline catches it, routes it
47
+ * to `onError`, and moves on.
48
+ */
49
+ interface Plugin {
50
+ /** Return a (possibly modified) record, or `null` to drop it. */
51
+ beforeLog?(record: LogRecord): LogRecord | null;
52
+ /** Called after the record has been dispatched to every transport. */
53
+ afterLog?(record: LogRecord): void;
54
+ /** Called when one of this plugin's own hooks throws. */
55
+ onError?(error: unknown, record: LogRecord): void;
56
+ }
57
+
58
+ /**
59
+ * Injects fixed key/value pairs into every record's `meta`.
60
+ * A value already present in a record's own `meta` wins over the fixed context.
61
+ */
62
+ declare class ContextPlugin implements Plugin {
63
+ readonly context: Record<string, unknown>;
64
+ constructor(context: Record<string, unknown>);
65
+ beforeLog(record: LogRecord): LogRecord;
66
+ }
67
+
68
+ declare const DEFAULT_REDACTED_KEYS: readonly string[];
69
+ interface RedactPluginOptions {
70
+ keys?: readonly string[];
71
+ replacement?: string;
72
+ }
73
+ /** Replaces sensitive `meta` values, matched by key (case-insensitive), with a placeholder. */
74
+ declare class RedactPlugin implements Plugin {
75
+ private readonly keys;
76
+ readonly replacement: string;
77
+ constructor(options?: RedactPluginOptions);
78
+ beforeLog(record: LogRecord): LogRecord;
79
+ }
80
+
81
+ interface SamplingPluginOptions {
82
+ rng?: () => number;
83
+ }
84
+ /** Keeps roughly `rate` of records (0.0-1.0), dropping the rest. */
85
+ declare class SamplingPlugin implements Plugin {
86
+ readonly rate: number;
87
+ private readonly rng;
88
+ constructor(rate: number, options?: SamplingPluginOptions);
89
+ beforeLog(record: LogRecord): LogRecord | null;
90
+ }
91
+
92
+ /**
93
+ * Sink for log records, per the cross-language transport contract:
94
+ * `format(record) -> string`, `write(formatted, record)`, `close()` on shutdown.
95
+ */
96
+ declare abstract class Transport {
97
+ formatter: Formatter;
98
+ constructor(formatter?: Formatter);
99
+ format(record: LogRecord): string;
100
+ abstract write(formatted: string, record: LogRecord): void;
101
+ /** Flush/release resources on shutdown. No-op unless a transport overrides it. */
102
+ close(): void;
103
+ }
104
+ /** In-memory transport for tests: collects every (formatted, record) pair written to it. */
105
+ declare class CollectingTransport extends Transport {
106
+ readonly formatted: string[];
107
+ readonly records: LogRecord[];
108
+ closed: boolean;
109
+ write(formatted: string, record: LogRecord): void;
110
+ close(): void;
111
+ }
112
+
113
+ interface BatchingTransportOptions {
114
+ formatter?: Formatter;
115
+ /** Flush once the buffer holds this many items. Default 100. */
116
+ maxRecords?: number;
117
+ /** Flush once the buffer's estimated byte size reaches this many bytes. Default 1_000_000 (1MB). */
118
+ maxBytes?: number;
119
+ }
120
+ /**
121
+ * Shared base for every batching sink transport (SQL, NoSQL, message queues,
122
+ * batching cloud-native transports). Buffers items and flushes once either
123
+ * `maxRecords` or `maxBytes` is reached, so no batching transport can grow
124
+ * its buffer unboundedly under a sustained burst.
125
+ *
126
+ * `write()`/`close()` stay non-blocking from the caller's perspective: a
127
+ * failed `sendBatch()` is reported via `console.error` rather than thrown,
128
+ * matching `HTTPTransport`'s contract.
129
+ */
130
+ declare abstract class BatchingTransport<T = LogRecord> extends Transport {
131
+ readonly maxRecords: number;
132
+ readonly maxBytes: number;
133
+ private buffer;
134
+ private bufferBytes;
135
+ constructor(options?: BatchingTransportOptions);
136
+ /** Converts a written record into the buffered item type. Defaults to the record itself. */
137
+ protected toItem(formatted: string, record: LogRecord): T;
138
+ /** Estimated byte size of one buffered item, used for the `maxBytes` bound. */
139
+ protected sizeOf(item: T): number;
140
+ write(formatted: string, record: LogRecord): void;
141
+ /** Send the current batch now, even if it hasn't reached a bound. */
142
+ flush(): void;
143
+ close(): void;
144
+ /** Deliver one batch to the backend. Always called with a non-empty batch. */
145
+ protected abstract sendBatch(batch: readonly T[]): Promise<void> | void;
146
+ }
147
+
148
+ /** One row of the fixed `logs` table schema shared across every SQL transport. */
149
+ interface SQLLogRow {
150
+ timestamp: string;
151
+ level: string;
152
+ logger: string;
153
+ message: string;
154
+ /** `record.meta`, JSON-serialized — every SQL dialect can store this as TEXT/JSON/JSONB. */
155
+ meta: string;
156
+ runId: string | null;
157
+ spanId: string | null;
158
+ parentSpanId: string | null;
159
+ traceId: string | null;
160
+ }
161
+ interface BaseSQLTransportOptions extends BatchingTransportOptions {
162
+ /** Table to write into. Default `"logs"`. */
163
+ tableName?: string;
164
+ /**
165
+ * Dev/test convenience only: run `createTableSQL()` before the first insert.
166
+ * Production schema/migrations are the caller's responsibility — never
167
+ * auto-create schema unless this is explicitly set. Default `false`.
168
+ */
169
+ ensureSchema?: boolean;
170
+ }
171
+ /**
172
+ * Abstract base for every SQL transport (`SQLiteTransport`, `PostgresTransport`,
173
+ * `MySQLTransport`, ...). Owns the fixed schema and the record → row mapping;
174
+ * each driver-specific subclass only implements `ensureTable()`/`insertRows()`.
175
+ * Inserts are always batched — never one query per log call.
176
+ */
177
+ declare abstract class BaseSQLTransport extends BatchingTransport<SQLLogRow> {
178
+ readonly tableName: string;
179
+ readonly ensureSchema: boolean;
180
+ private schemaEnsured;
181
+ constructor(options?: BaseSQLTransportOptions);
182
+ protected toItem(_formatted: string, record: LogRecord): SQLLogRow;
183
+ protected sizeOf(row: SQLLogRow): number;
184
+ /**
185
+ * Minimal, dialect-generic `CREATE TABLE IF NOT EXISTS` for dev/test use via
186
+ * `ensureSchema: true`. Production deployments should manage this table with
187
+ * a real migration instead — override in a subclass for dialect-correct
188
+ * column types (e.g. `JSONB` on Postgres).
189
+ */
190
+ createTableSQL(): string;
191
+ protected sendBatch(rows: readonly SQLLogRow[]): Promise<void>;
192
+ /** Only invoked when `ensureSchema: true` was explicitly passed. */
193
+ protected abstract ensureTable(): Promise<void>;
194
+ /** Always-batched insert of every row in `rows` — never one query per row. */
195
+ protected abstract insertRows(rows: readonly SQLLogRow[]): Promise<void>;
196
+ }
197
+
198
+ /** The subset of a `better-sqlite3` prepared statement that `SQLiteTransport` needs. */
199
+ interface SQLiteStatementLike {
200
+ run(...params: unknown[]): unknown;
201
+ }
202
+ /** The subset of a `better-sqlite3` `Database` that `SQLiteTransport` needs. Inject a fake in tests. */
203
+ interface SQLiteClientLike {
204
+ exec(sql: string): unknown;
205
+ prepare(sql: string): SQLiteStatementLike;
206
+ transaction<Args extends unknown[]>(fn: (...args: Args) => void): (...args: Args) => void;
207
+ }
208
+ interface SQLiteTransportOptions extends BaseSQLTransportOptions {
209
+ /** Pre-built client, e.g. for tests. Skips the `better-sqlite3` auto-import entirely. */
210
+ client?: SQLiteClientLike;
211
+ /** Passed to `better-sqlite3` when no `client` is injected. Default `":memory:"`. */
212
+ filename?: string;
213
+ }
214
+ /**
215
+ * Zero-setup SQL sink — no server process, just a local (or in-memory) file
216
+ * via `better-sqlite3`. Useful for local dev and pairs with the CLI trace
217
+ * viewer (v2.0), which can read this file directly.
218
+ *
219
+ * `better-sqlite3` is an optional peer dependency: install it yourself, or
220
+ * inject a `client` (e.g. a fake, or an already-open `Database` instance).
221
+ */
222
+ declare class SQLiteTransport extends BaseSQLTransport {
223
+ private readonly injectedClient;
224
+ private readonly filename;
225
+ private client;
226
+ constructor(options?: SQLiteTransportOptions);
227
+ /** Synchronously available client, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
228
+ private resolvedClient;
229
+ private importClient;
230
+ protected ensureTable(): Promise<void>;
231
+ protected insertRows(rows: readonly SQLLogRow[]): Promise<void>;
232
+ }
233
+
234
+ /** The subset of a `pg` `Pool`/`Client` that `PostgresTransport` needs. Inject a fake in tests. */
235
+ interface PgClientLike {
236
+ query(text: string, values: unknown[]): Promise<unknown>;
237
+ }
238
+ interface PostgresTransportOptions extends BaseSQLTransportOptions {
239
+ /** Pre-built client/pool, e.g. for tests, or an already-open `pg.Pool`/`pg.Client`. Skips the `pg` auto-import entirely. */
240
+ client?: PgClientLike;
241
+ /** Passed to `pg.Pool` when no `client` is injected, e.g. `"postgres://user:pass@host:5432/db"`. */
242
+ connectionString?: string;
243
+ /** Passed to `pg.Pool` when no `client` is injected and `connectionString` isn't used. */
244
+ connectionConfig?: Record<string, unknown>;
245
+ }
246
+ /**
247
+ * SQL sink backed by Postgres via `pg`. Builds one parameterized multi-row
248
+ * `INSERT` per batch — never one query per log call — matching the
249
+ * always-batched contract every `BaseSQLTransport` subclass shares.
250
+ *
251
+ * `pg` is an optional peer dependency: install it yourself, or inject a
252
+ * `client` (e.g. a fake, or an already-open `Pool`/`Client` instance).
253
+ */
254
+ declare class PostgresTransport extends BaseSQLTransport {
255
+ private readonly injectedClient;
256
+ private readonly connectionString;
257
+ private readonly connectionConfig;
258
+ private client;
259
+ constructor(options?: PostgresTransportOptions);
260
+ /** Synchronously available client, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
261
+ private resolvedClient;
262
+ private importClient;
263
+ /** Postgres-correct `CREATE TABLE IF NOT EXISTS`: `SERIAL` primary key, `JSONB` for `meta`. */
264
+ createTableSQL(): string;
265
+ protected ensureTable(): Promise<void>;
266
+ protected insertRows(rows: readonly SQLLogRow[]): Promise<void>;
267
+ }
268
+
269
+ /** The subset of a `mysql2/promise` connection/pool that `MySQLTransport` needs. Inject a fake in tests. */
270
+ interface MySQLClientLike {
271
+ execute(sql: string, values: unknown[]): Promise<unknown>;
272
+ }
273
+ interface MySQLTransportOptions extends BaseSQLTransportOptions {
274
+ /** Pre-built client/pool, e.g. for tests, or an already-open `mysql2/promise` `Pool`/`Connection`. Skips the `mysql2` auto-import entirely. */
275
+ client?: MySQLClientLike;
276
+ /** Passed to `mysql2/promise`'s `createPool` when no `client` is injected, e.g. `"mysql://user:pass@host:3306/db"`. */
277
+ connectionString?: string;
278
+ /** Passed to `mysql2/promise`'s `createPool` when no `client` is injected and `connectionString` isn't used. */
279
+ connectionConfig?: Record<string, unknown>;
280
+ }
281
+ /**
282
+ * SQL sink backed by MySQL via `mysql2`. Builds one parameterized multi-row
283
+ * `INSERT` per batch — never one query per log call — matching the
284
+ * always-batched contract every `BaseSQLTransport` subclass shares.
285
+ *
286
+ * `mysql2` is an optional peer dependency: install it yourself, or inject a
287
+ * `client` (e.g. a fake, or an already-open pool/connection from
288
+ * `mysql2/promise`).
289
+ */
290
+ declare class MySQLTransport extends BaseSQLTransport {
291
+ private readonly injectedClient;
292
+ private readonly connectionString;
293
+ private readonly connectionConfig;
294
+ private client;
295
+ constructor(options?: MySQLTransportOptions);
296
+ /** Synchronously available client, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
297
+ private resolvedClient;
298
+ private importClient;
299
+ /** MySQL-correct `CREATE TABLE IF NOT EXISTS`: `AUTO_INCREMENT` primary key, `JSON` column type for `meta`. */
300
+ createTableSQL(): string;
301
+ protected ensureTable(): Promise<void>;
302
+ protected insertRows(rows: readonly SQLLogRow[]): Promise<void>;
303
+ }
304
+
305
+ /** The subset of a `mongodb` `Collection` that `MongoDBTransport` needs. Inject a fake in tests. */
306
+ interface MongoCollectionLike {
307
+ insertMany(docs: readonly unknown[]): Promise<unknown>;
308
+ }
309
+ /** The subset of a `mongodb` `MongoClient` that `MongoDBTransport` needs to lazily connect. */
310
+ interface MongoClientLike {
311
+ connect(): Promise<unknown>;
312
+ db(name: string): {
313
+ collection(name: string): MongoCollectionLike;
314
+ };
315
+ }
316
+ interface MongoDBTransportOptions extends BatchingTransportOptions {
317
+ /** Pre-built collection, e.g. for tests, or an already-connected app. Skips the `mongodb` auto-import entirely. */
318
+ collection?: MongoCollectionLike;
319
+ /** `mongodb` connection string, used when no `collection` is injected. Required in that case. */
320
+ connectionString?: string;
321
+ /** Database to write into when connecting via `connectionString`. Default `"logquill"`. */
322
+ database?: string;
323
+ /** Collection to write into when connecting via `connectionString`. Default `"logs"`. */
324
+ collectionName?: string;
325
+ }
326
+ /**
327
+ * Sink for MongoDB. Records map 1:1 to documents — no JSON-in-a-column
328
+ * workaround needed, unlike the SQL transports.
329
+ *
330
+ * `mongodb` is an optional peer dependency: install it yourself, or inject a
331
+ * `collection` (e.g. a fake, or a `Collection` from a client your app already
332
+ * manages).
333
+ */
334
+ declare class MongoDBTransport extends BatchingTransport {
335
+ private readonly injectedCollection;
336
+ private readonly connectionString;
337
+ private readonly database;
338
+ private readonly collectionName;
339
+ private collection;
340
+ constructor(options?: MongoDBTransportOptions);
341
+ /** Synchronously available collection, if one was injected or already connected — avoids an unnecessary microtask hop on the hot path. */
342
+ private resolvedCollection;
343
+ private importCollection;
344
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void>;
345
+ }
346
+
347
+ /** One item written to DynamoDB: `runId` is the partition key, `timestamp` is the sort key. */
348
+ interface DynamoLogItem {
349
+ runId: string;
350
+ timestamp: string;
351
+ level: string;
352
+ logger: string;
353
+ message: string;
354
+ meta: Record<string, unknown>;
355
+ spanId?: string;
356
+ parentSpanId?: string;
357
+ traceId?: string;
358
+ }
359
+ /**
360
+ * The subset of DynamoDB write access `DynamoDBTransport` needs, deliberately
361
+ * narrower than the AWS SDK v3 command pattern (`send(command)`): one
362
+ * `BatchWriteItem`-equivalent call per sub-batch, already capped at
363
+ * `DYNAMO_BATCH_LIMIT` items by the caller. This keeps fake-based tests
364
+ * trivial — a fake just needs to record `(tableName, items)` calls, not
365
+ * emulate a `DynamoDBClient`. Inject a fake in tests, or rely on the built-in
366
+ * `@aws-sdk/client-dynamodb` wrapper by not injecting a `client`.
367
+ */
368
+ interface DynamoClientLike {
369
+ batchWriteItems(tableName: string, items: readonly DynamoLogItem[]): Promise<unknown>;
370
+ }
371
+ interface DynamoDBTransportOptions extends BatchingTransportOptions {
372
+ /** Pre-built client, e.g. for tests, or a custom wrapper. Skips the `@aws-sdk/client-dynamodb` auto-import entirely. */
373
+ client?: DynamoClientLike;
374
+ /** Table to write into. Default `"logs"`. */
375
+ tableName?: string;
376
+ /** AWS region, used when no `client` is injected. Falls back to the SDK's own credential-chain resolution when omitted. */
377
+ region?: string;
378
+ }
379
+ /**
380
+ * Sink for Amazon DynamoDB. Partition key is `runId`/`traceId` (whichever is
381
+ * present on `record.meta`, `runId` taking priority), falling back to the
382
+ * logger name when neither is set, so every record always lands under some
383
+ * partition even before `RunPlugin`/`TraceContextPlugin` are wired up. Sort
384
+ * key is `timestamp`.
385
+ *
386
+ * DynamoDB's actual `BatchWriteItem` API caps a call at 25 items, so
387
+ * `sendBatch()` chunks a larger batch into sub-batches of 25 — matching how
388
+ * `SQSTransport` respects `SendMessageBatch`'s 10-item cap.
389
+ *
390
+ * `@aws-sdk/client-dynamodb` is an optional peer dependency: install it
391
+ * yourself, or inject a `client` (e.g. a fake, or a custom wrapper around a
392
+ * `DynamoDBClient` your app already manages).
393
+ */
394
+ declare class DynamoDBTransport extends BatchingTransport {
395
+ private readonly injectedClient;
396
+ private readonly tableName;
397
+ private readonly region;
398
+ private client;
399
+ constructor(options?: DynamoDBTransportOptions);
400
+ /** Synchronously available client, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
401
+ private resolvedClient;
402
+ private importClient;
403
+ /** `meta.runId`, else `meta.traceId`, else the logger name — see the class doc for why. */
404
+ private partitionKey;
405
+ private toDynamoItem;
406
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void>;
407
+ }
408
+
409
+ /** The subset of a `redis` (node-redis v4) client that `RedisTransport` needs. Inject a fake in tests. */
410
+ interface RedisClientLike {
411
+ xAdd(stream: string, id: string, fields: Record<string, string>): Promise<unknown>;
412
+ }
413
+ interface RedisTransportOptions extends BatchingTransportOptions {
414
+ /** Pre-built, already-connected client, e.g. for tests. Skips the `redis` auto-import entirely. */
415
+ client?: RedisClientLike;
416
+ /** `redis` connection URL, used when no `client` is injected. Default `"redis://localhost:6379"`. */
417
+ url?: string;
418
+ /** Stream key to `XADD` into. Default `"logquill:logs"`. */
419
+ stream?: string;
420
+ }
421
+ /**
422
+ * Sink for Redis, via Redis Streams (`XADD`) — as CLAUDE.md's spec puts it,
423
+ * "a fast local buffer, a different use case from durable storage, not a
424
+ * replacement for the others." Reach for this when you want a low-latency
425
+ * local tail (e.g. feeding a `redis-cli XREAD`-based live viewer) rather than
426
+ * a system of record.
427
+ *
428
+ * Streams has no true multi-entry `XADD`, so unlike the other batching
429
+ * transports this issues one `XADD` per record within the batch rather than
430
+ * one network call per batch — batching here still bounds memory and reduces
431
+ * GC/buffer churn, but it is honestly not a network-call batch the way
432
+ * `MongoDBTransport.insertMany()` or `DynamoDBTransport`'s `BatchWriteItem`
433
+ * chunks are.
434
+ *
435
+ * `redis` is an optional peer dependency: install it yourself, or inject a
436
+ * `client` (e.g. a fake, or an already-connected client your app manages).
437
+ */
438
+ declare class RedisTransport extends BatchingTransport {
439
+ private readonly injectedClient;
440
+ private readonly url;
441
+ private readonly stream;
442
+ private client;
443
+ constructor(options?: RedisTransportOptions);
444
+ /** Synchronously available client, if one was injected or already connected — avoids an unnecessary microtask hop on the hot path. */
445
+ private resolvedClient;
446
+ private importClient;
447
+ private toFields;
448
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void>;
449
+ }
450
+
451
+ interface BaseQueueTransportOptions extends BatchingTransportOptions {
452
+ /**
453
+ * Destination name on the backend — a Kafka topic, a RabbitMQ queue name,
454
+ * an SQS queue URL, or a GCP Pub/Sub topic. One generic option name so the
455
+ * base class's orchestration stays backend-agnostic; each subclass's own
456
+ * docs use its backend's own vocabulary for what this means.
457
+ */
458
+ topic: string;
459
+ }
460
+ /**
461
+ * Abstract base for every message-queue transport (`KafkaTransport`,
462
+ * `RabbitMQTransport`, `SQSTransport`, `PubSubTransport`). Owns the "always
463
+ * batch, never publish one message per log call" contract shared across
464
+ * every queue backend — buffering itself is inherited from
465
+ * `BatchingTransport`; each concrete subclass only implements
466
+ * `publishBatch()` against its own driver's publish API.
467
+ */
468
+ declare abstract class BaseQueueTransport extends BatchingTransport {
469
+ readonly topic: string;
470
+ constructor(options: BaseQueueTransportOptions);
471
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void>;
472
+ /** Deliver one batch of records to the queue backend. Always called with a non-empty batch. */
473
+ protected abstract publishBatch(records: readonly LogRecord[]): Promise<void>;
474
+ }
475
+
476
+ /** The subset of a `kafkajs` `Producer` that `KafkaTransport` needs. Inject a fake in tests. */
477
+ interface KafkaProducerLike {
478
+ /** Optional: some injected producers (or fakes) are already connected. */
479
+ connect?(): Promise<void>;
480
+ send(record: {
481
+ topic: string;
482
+ messages: {
483
+ key: string | null;
484
+ value: string;
485
+ }[];
486
+ }): Promise<unknown>;
487
+ }
488
+ interface KafkaTransportOptions extends BaseQueueTransportOptions {
489
+ /** Pre-built producer, e.g. for tests, or an already-configured kafkajs `Producer`. Skips the `kafkajs` auto-import entirely. */
490
+ client?: KafkaProducerLike;
491
+ /** Broker addresses passed to `kafkajs`'s `Kafka({ brokers })` when no `client` is injected. Default `["localhost:9092"]`. */
492
+ brokers?: string[];
493
+ }
494
+ /**
495
+ * Publishes batches to a Kafka topic via `kafkajs`. Each message's `key` is
496
+ * set to `meta.runId` (falling back to `meta.traceId`, then `null`), so
497
+ * kafkajs's default partitioner keeps every message from the same agent
498
+ * run/trace on one partition — preserving per-trace ordering, per the
499
+ * message-queue contract in the project spec.
500
+ *
501
+ * `kafkajs` is an optional peer dependency: install it yourself, or inject a
502
+ * `client` (e.g. a fake, or an already-configured `Producer`).
503
+ */
504
+ declare class KafkaTransport extends BaseQueueTransport {
505
+ private readonly injectedClient;
506
+ private readonly brokers;
507
+ private client;
508
+ constructor(options: KafkaTransportOptions);
509
+ /** Synchronously available producer, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
510
+ private resolvedClient;
511
+ /**
512
+ * Builds the real `kafkajs` producer and connects it. Connection happens
513
+ * here, once, as part of acquiring the driver — not on every
514
+ * `publishBatch()` call — so an injected `client` (tests, or a caller's
515
+ * own already-connected producer) is trusted to already be ready and is
516
+ * never re-connected.
517
+ */
518
+ private importClient;
519
+ protected publishBatch(records: readonly LogRecord[]): Promise<void>;
520
+ }
521
+
522
+ /** The subset of an `amqplib` `Channel` that `RabbitMQTransport` needs. Inject a fake in tests. */
523
+ interface AmqpChannelLike {
524
+ /** Optional: only called once, and only when provided, to ensure the queue exists. */
525
+ assertQueue?(queue: string, options?: unknown): Promise<unknown>;
526
+ sendToQueue(queue: string, content: Buffer, options?: unknown): boolean;
527
+ }
528
+ interface RabbitMQTransportOptions extends BaseQueueTransportOptions {
529
+ /** Pre-built channel, e.g. for tests, or an already-open amqplib `Channel`. Skips the `amqplib` auto-import entirely. */
530
+ client?: AmqpChannelLike;
531
+ /** Connection URL passed to `amqplib.connect()` when no `client` is injected. Default `"amqp://localhost"`. */
532
+ url?: string;
533
+ }
534
+ /**
535
+ * Publishes batches to a RabbitMQ queue via `amqplib`. RabbitMQ's core API
536
+ * has no native multi-message batch primitive — there is no
537
+ * `sendToQueue`-equivalent that takes an array — so `publishBatch()` loops
538
+ * one `sendToQueue()` call per record. The "batch" LogQuill promises is at
539
+ * the buffering level: `maxRecords`/`maxBytes` still governs how often that
540
+ * loop runs, so this transport never makes one network round trip per log
541
+ * call; it just can't make one round trip per *batch* either, honestly,
542
+ * since RabbitMQ itself doesn't offer that primitive.
543
+ *
544
+ * `amqplib` is an optional peer dependency: install it yourself, or inject a
545
+ * `client` (e.g. a fake, or an already-open `Channel`).
546
+ */
547
+ declare class RabbitMQTransport extends BaseQueueTransport {
548
+ private readonly injectedClient;
549
+ private readonly url;
550
+ private client;
551
+ constructor(options: RabbitMQTransportOptions);
552
+ /** Synchronously available channel, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
553
+ private resolvedClient;
554
+ /**
555
+ * Opens the real `amqplib` connection/channel and asserts the queue
556
+ * exists. Both happen here, once, as part of acquiring the driver — not on
557
+ * every `publishBatch()` call — so an injected `client` (tests, or a
558
+ * caller's own already-open channel) is trusted to already have its queue
559
+ * set up and is never re-asserted.
560
+ */
561
+ private importClient;
562
+ protected publishBatch(records: readonly LogRecord[]): Promise<void>;
563
+ }
564
+
565
+ /**
566
+ * The subset of AWS SDK v3's SQS client that `SQSTransport` needs, narrowed
567
+ * to a plain `sendMessageBatch(queueUrl, entries)` method rather than
568
+ * modeling the full `@aws-sdk/client-sqs` command/client pattern — simpler
569
+ * to fake in tests, and the only shape this transport actually calls. Inject
570
+ * a fake in tests, or wrap a real `SQSClient` to match this shape.
571
+ */
572
+ interface SQSClientLike {
573
+ sendMessageBatch(queueUrl: string, entries: {
574
+ id: string;
575
+ body: string;
576
+ }[]): Promise<unknown>;
577
+ }
578
+ interface SQSTransportOptions extends BaseQueueTransportOptions {
579
+ /** Pre-built client, e.g. for tests, or a thin wrapper around `@aws-sdk/client-sqs`'s `SQSClient`. Skips the `@aws-sdk/client-sqs` auto-import entirely. */
580
+ client?: SQSClientLike;
581
+ /** AWS region passed to `@aws-sdk/client-sqs` when no `client` is injected. */
582
+ region?: string;
583
+ }
584
+ /**
585
+ * Publishes batches to an SQS queue via `@aws-sdk/client-sqs`'s
586
+ * `SendMessageBatch`. That API caps a single request at 10 messages, so
587
+ * `publishBatch()` chunks any larger batch into sub-batches of 10 —
588
+ * LogQuill's own `maxRecords`/`maxBytes` buffering can flush more than 10
589
+ * records at once; this transport is responsible for respecting SQS's own
590
+ * limit underneath, per the message-queue contract in the project spec.
591
+ *
592
+ * `@aws-sdk/client-sqs` is an optional peer dependency: install it
593
+ * yourself, or inject a `client` (e.g. a fake, or a wrapped `SQSClient`).
594
+ */
595
+ declare class SQSTransport extends BaseQueueTransport {
596
+ private readonly injectedClient;
597
+ private readonly region;
598
+ private client;
599
+ constructor(options: SQSTransportOptions);
600
+ /** Synchronously available client, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
601
+ private resolvedClient;
602
+ private importClient;
603
+ protected publishBatch(records: readonly LogRecord[]): Promise<void>;
604
+ }
605
+
606
+ /**
607
+ * The subset of a `@google-cloud/pubsub` `Topic` that `PubSubTransport`
608
+ * needs. Inject a fake in tests, or an already-resolved `Topic` instance.
609
+ */
610
+ interface PubSubTopicLike {
611
+ publishMessage(message: {
612
+ data: Buffer;
613
+ }): Promise<string>;
614
+ }
615
+ interface PubSubTransportOptions extends BaseQueueTransportOptions {
616
+ /** Pre-built topic reference, e.g. for tests, or an already-resolved `@google-cloud/pubsub` `Topic`. Skips the `@google-cloud/pubsub` auto-import entirely. */
617
+ client?: PubSubTopicLike;
618
+ /** GCP project ID passed to `@google-cloud/pubsub` when no `client` is injected. */
619
+ projectId?: string;
620
+ }
621
+ /**
622
+ * Publishes batches to a GCP Pub/Sub topic via `@google-cloud/pubsub`. The
623
+ * real client already does its own internal batching/flow-control underneath
624
+ * `publishMessage()` — this transport doesn't reimplement that. What it does
625
+ * own is LogQuill's own bounded-memory contract: `publishBatch()` only runs
626
+ * once per buffer flush (`maxRecords`/`maxBytes`), so the driver is never
627
+ * invoked once per individual log call.
628
+ *
629
+ * `@google-cloud/pubsub` is an optional peer dependency: install it
630
+ * yourself, or inject a `client` (e.g. a fake, or a resolved `Topic`).
631
+ */
632
+ declare class PubSubTransport extends BaseQueueTransport {
633
+ private readonly injectedClient;
634
+ private readonly projectId;
635
+ private client;
636
+ constructor(options: PubSubTransportOptions);
637
+ /** Synchronously available topic reference, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
638
+ private resolvedClient;
639
+ private importClient;
640
+ protected publishBatch(records: readonly LogRecord[]): Promise<void>;
641
+ }
642
+
643
+ /** One CloudWatch Logs event: epoch-milliseconds timestamp plus a single log line. */
644
+ interface CloudWatchLogEvent {
645
+ timestamp: number;
646
+ message: string;
647
+ }
648
+ /**
649
+ * The subset of the AWS SDK v3 CloudWatch Logs client that `CloudWatchTransport`
650
+ * needs. Deliberately narrower than the SDK's full command pattern (build a
651
+ * `PutLogEventsCommand`, `.send()` it, track the deprecated sequence-token
652
+ * dance) — modeling just this one operation keeps the injectable-fake surface
653
+ * small for tests; `importClient()` builds the real adapter around it.
654
+ */
655
+ interface CloudWatchClientLike {
656
+ putLogEvents(logGroupName: string, logStreamName: string, events: readonly CloudWatchLogEvent[]): Promise<unknown>;
657
+ }
658
+ interface CloudWatchTransportOptions extends BatchingTransportOptions {
659
+ /** CloudWatch Logs log group to write into. */
660
+ logGroupName: string;
661
+ /** CloudWatch Logs log stream, within `logGroupName`, to write into. */
662
+ logStreamName: string;
663
+ /** AWS region, e.g. `"us-east-1"`. Passed to the real SDK client; ignored when `client` is injected. */
664
+ region?: string;
665
+ /** Pre-built client, e.g. for tests. Skips the `@aws-sdk/client-cloudwatch-logs` auto-import entirely. */
666
+ client?: CloudWatchClientLike;
667
+ }
668
+ /**
669
+ * Ships batched records to AWS CloudWatch Logs via the AWS SDK v3
670
+ * (`@aws-sdk/client-cloudwatch-logs`). Each buffered record becomes one log
671
+ * event; CloudWatch requires events within a single `PutLogEvents` call to be
672
+ * sorted by timestamp ascending, which `sendBatch()` does before sending.
673
+ *
674
+ * `@aws-sdk/client-cloudwatch-logs` is an optional peer dependency: install
675
+ * it yourself, or inject a `client` (e.g. a fake, or an already-configured
676
+ * `CloudWatchLogsClient` wrapped to match `CloudWatchClientLike`).
677
+ */
678
+ declare class CloudWatchTransport extends BatchingTransport {
679
+ readonly logGroupName: string;
680
+ readonly logStreamName: string;
681
+ readonly region: string | undefined;
682
+ private readonly injectedClient;
683
+ private client;
684
+ constructor(options: CloudWatchTransportOptions);
685
+ /** Synchronously available client, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
686
+ private resolvedClient;
687
+ private importClient;
688
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void>;
689
+ }
690
+
691
+ /** One GCP Cloud Logging entry, shaped for `Log#write`. */
692
+ interface CloudLoggingEntry {
693
+ severity: string;
694
+ timestamp: string;
695
+ jsonPayload: Record<string, unknown>;
696
+ }
697
+ /**
698
+ * The subset of the `@google-cloud/logging` client that `CloudLoggingTransport`
699
+ * needs. Deliberately narrower than the SDK's full `Log`/`Entry` object model —
700
+ * `importClient()` builds the real adapter around `logging.log(name).write(entries)`.
701
+ */
702
+ interface CloudLoggingClientLike {
703
+ writeLogEntries(entries: readonly CloudLoggingEntry[]): Promise<unknown>;
704
+ }
705
+ interface CloudLoggingTransportOptions extends BatchingTransportOptions {
706
+ /** GCP log name (the last segment of the log resource path). Default `"logquill"`. */
707
+ logName?: string;
708
+ /** GCP project ID. Passed to the real SDK client; ignored when `client` is injected — omit to use Application Default Credentials' project. */
709
+ projectId?: string;
710
+ /** Pre-built client, e.g. for tests. Skips the `@google-cloud/logging` auto-import entirely. */
711
+ client?: CloudLoggingClientLike;
712
+ }
713
+ /**
714
+ * Ships batched records to Google Cloud Logging via `@google-cloud/logging`.
715
+ * Each record becomes one structured entry (`jsonPayload`), with `level`
716
+ * mapped onto Cloud Logging's `severity` enum.
717
+ *
718
+ * `@google-cloud/logging` is an optional peer dependency: install it
719
+ * yourself, or inject a `client` (e.g. a fake, or an already-configured
720
+ * `Log` wrapped to match `CloudLoggingClientLike`).
721
+ */
722
+ declare class CloudLoggingTransport extends BatchingTransport {
723
+ readonly logName: string;
724
+ readonly projectId: string | undefined;
725
+ private readonly injectedClient;
726
+ private client;
727
+ constructor(options?: CloudLoggingTransportOptions);
728
+ /** Synchronously available client, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
729
+ private resolvedClient;
730
+ private importClient;
731
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void>;
732
+ }
733
+
734
+ /** One Application Insights trace: a message plus its `SeverityLevel`. */
735
+ interface AppInsightsTrace {
736
+ message: string;
737
+ severity: number;
738
+ }
739
+ /**
740
+ * The subset of Application Insights telemetry that `AppInsightsTransport`
741
+ * needs.
742
+ *
743
+ * `trackTraceBatch` is LogQuill's own batching contract, not a native
744
+ * `applicationinsights` SDK method — the real SDK only exposes a single-record
745
+ * `trackTrace()` plus an async `flush()`. The real-client adapter built by
746
+ * `importClient()` loops `trackTrace()` calls inside `trackTraceBatch` and
747
+ * flushes once at the end, so batching happens at the LogQuill buffering
748
+ * level (bounded by `maxRecords`/`maxBytes`), not as a real network-level
749
+ * batch call — Application Insights doesn't offer one.
750
+ */
751
+ interface AppInsightsClientLike {
752
+ trackTraceBatch(traces: readonly AppInsightsTrace[]): Promise<unknown>;
753
+ }
754
+ interface AppInsightsTransportOptions extends BatchingTransportOptions {
755
+ /** Azure Application Insights connection string. Passed to the real SDK client; ignored when `client` is injected. */
756
+ connectionString?: string;
757
+ /** Pre-built client, e.g. for tests. Skips the `applicationinsights` auto-import entirely. */
758
+ client?: AppInsightsClientLike;
759
+ }
760
+ /**
761
+ * Ships batched records to Azure Application Insights via `applicationinsights`,
762
+ * as trace telemetry with `level` mapped onto Application Insights' severity
763
+ * scale. See `AppInsightsClientLike` for why "batch" means LogQuill-side
764
+ * buffering plus a loop of single `trackTrace()` calls, not one network batch
765
+ * request — the underlying SDK has no batch-track API.
766
+ *
767
+ * `applicationinsights` is an optional peer dependency: install it yourself,
768
+ * or inject a `client` (e.g. a fake, or an already-configured `TelemetryClient`
769
+ * wrapped to match `AppInsightsClientLike`).
770
+ */
771
+ declare class AppInsightsTransport extends BatchingTransport {
772
+ readonly connectionString: string | undefined;
773
+ private readonly injectedClient;
774
+ private client;
775
+ constructor(options?: AppInsightsTransportOptions);
776
+ /** Synchronously available client, if one was injected or already imported — avoids an unnecessary microtask hop on the hot path. */
777
+ private resolvedClient;
778
+ private importClient;
779
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void>;
780
+ }
781
+
782
+ /** Sends one batch of formatted lines to Datadog's Logs intake API at `url`. Swap in a fake for tests. */
783
+ type DatadogSender = (url: string, apiKey: string, batch: readonly string[]) => Promise<void> | void;
784
+ interface DatadogTransportOptions extends BatchingTransportOptions {
785
+ /** Datadog API key, sent in the `DD-API-KEY` header. */
786
+ apiKey: string;
787
+ /**
788
+ * Datadog site (region), e.g. `"datadoghq.com"` (US1, default),
789
+ * `"datadoghq.eu"` (EU), `"us3.datadoghq.com"`, `"us5.datadoghq.com"`,
790
+ * `"ap1.datadoghq.com"`. Never hardcode this — sending to the wrong
791
+ * region's intake host silently fails to deliver logs to your account.
792
+ */
793
+ site?: string;
794
+ sender?: DatadogSender;
795
+ }
796
+ /**
797
+ * Batches records and POSTs them as a JSON array to Datadog's Logs intake
798
+ * API (`https://http-intake.logs.<site>/api/v2/logs`) via `fetch`. Pass
799
+ * `sender` to swap in a fake for tests, or a different delivery mechanism.
800
+ */
801
+ declare class DatadogTransport extends BatchingTransport {
802
+ readonly url: string;
803
+ readonly apiKey: string;
804
+ readonly site: string;
805
+ private readonly sender;
806
+ constructor(options: DatadogTransportOptions);
807
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void> | void;
808
+ }
809
+
810
+ /** Sends one pre-built NDJSON `_bulk` body to `url` with the given headers. Swap in a fake for tests. */
811
+ type ElasticsearchSender = (url: string, headers: Readonly<Record<string, string>>, body: string) => Promise<void> | void;
812
+ interface ElasticsearchTransportOptions extends BatchingTransportOptions {
813
+ /** Cluster base URL, e.g. `"https://localhost:9200"`. */
814
+ node: string;
815
+ /** Index to write into. Default `"logs"`. */
816
+ index?: string;
817
+ /** Elasticsearch API key (base64 `id:api_key`), sent as `Authorization: ApiKey <apiKey>`. Omit to send no auth header (e.g. behind a proxy that adds its own). */
818
+ apiKey?: string;
819
+ sender?: ElasticsearchSender;
820
+ }
821
+ /**
822
+ * Batches records and POSTs them to Elasticsearch's `_bulk` API
823
+ * (`<node>/_bulk`) via `fetch`, as newline-delimited action+source pairs —
824
+ * no client dependency needed, just NDJSON body construction. Pass `sender`
825
+ * to swap in a fake for tests, or a different delivery mechanism.
826
+ */
827
+ declare class ElasticsearchTransport extends BatchingTransport {
828
+ readonly url: string;
829
+ readonly index: string;
830
+ private readonly apiKey;
831
+ private readonly sender;
832
+ constructor(options: ElasticsearchTransportOptions);
833
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void> | void;
834
+ }
835
+
836
+ /** Which New Relic ingest region to send to — determines the Log API host. */
837
+ type NewRelicRegion = "US" | "EU";
838
+ /** What `NewRelicSender` reports back about one delivery attempt, so the transport can drive its own 429 backoff logic. */
839
+ interface NewRelicSenderResult {
840
+ ok: boolean;
841
+ status: number;
842
+ /** The raw `Retry-After` response header value, if present — either a number of seconds or an HTTP-date, per RFC 9110. */
843
+ retryAfter: string | null;
844
+ }
845
+ /** Sends one gzip-compressed batch to New Relic's Log API at `url`. Swap in a fake for tests. */
846
+ type NewRelicSender = (url: string, headers: Readonly<Record<string, string>>, body: Buffer) => Promise<NewRelicSenderResult> | NewRelicSenderResult;
847
+ interface NewRelicTransportOptions extends BatchingTransportOptions {
848
+ /** New Relic license key, sent in the `Api-Key` header. */
849
+ licenseKey: string;
850
+ /**
851
+ * New Relic account region — selects the ingest host
852
+ * (`log-api.newrelic.com` for US, `log-api.eu.newrelic.com` for EU).
853
+ * Never hardcode this: an EU-region license key sent to the US host (or
854
+ * vice versa) is rejected. Default `"US"`.
855
+ */
856
+ region?: NewRelicRegion;
857
+ sender?: NewRelicSender;
858
+ /** Injectable clock for the 429 backoff window, matching `SamplingPlugin`'s injectable `rng`. Default `Date.now`. */
859
+ clock?: () => number;
860
+ }
861
+ /**
862
+ * Batches records and POSTs them, gzip-compressed, to New Relic's Log API
863
+ * (`log-api.newrelic.com` / `log-api.eu.newrelic.com`, region-configurable)
864
+ * via `fetch`. Strips the reserved `meta.eventType` key (New Relic drops
865
+ * records carrying it) and honors 429 responses by reading `Retry-After`
866
+ * and pausing further sends until it elapses, rather than hammering an
867
+ * account that's already been rate-limited for the rest of the minute.
868
+ *
869
+ * Pass `sender` to swap in a fake for tests, and `clock` to control time in
870
+ * backoff tests without waiting on a real clock.
871
+ */
872
+ declare class NewRelicTransport extends BatchingTransport {
873
+ readonly url: string;
874
+ readonly region: NewRelicRegion;
875
+ private readonly licenseKey;
876
+ private readonly sender;
877
+ private readonly clock;
878
+ private pausedUntil;
879
+ constructor(options: NewRelicTransportOptions);
880
+ protected sendBatch(batch: readonly LogRecord[]): Promise<void>;
881
+ }
882
+
883
+ /** The subset of `console` this transport needs — swap in a fake for tests. */
884
+ interface ConsoleLike {
885
+ log(message: string): void;
886
+ error(message: string): void;
887
+ }
888
+ interface ConsoleTransportOptions {
889
+ formatter?: Formatter;
890
+ colorize?: boolean;
891
+ console?: ConsoleLike;
892
+ }
893
+ /**
894
+ * Writes to `console.log`, routing ERROR/FATAL to `console.error`, colorized by
895
+ * level. Uses the global `console` rather than Node's `process.stdout`/`stderr`
896
+ * so this transport works unmodified in a browser bundle.
897
+ */
898
+ declare class ConsoleTransport extends Transport {
899
+ colorize: boolean;
900
+ private readonly out;
901
+ constructor(options?: ConsoleTransportOptions);
902
+ write(formatted: string, record: LogRecord): void;
903
+ private applyColor;
904
+ }
905
+
906
+ interface FileTransportOptions {
907
+ formatter?: Formatter;
908
+ maxBytes?: number;
909
+ backupCount?: number;
910
+ }
911
+ /** Appends formatted records to a file, rotating when it exceeds `maxBytes`. */
912
+ declare class FileTransport extends Transport {
913
+ readonly path: string;
914
+ readonly maxBytes: number;
915
+ readonly backupCount: number;
916
+ private fd;
917
+ constructor(path: string, options?: FileTransportOptions);
918
+ write(formatted: string): void;
919
+ private rotate;
920
+ close(): void;
921
+ }
922
+
923
+ /** Sends one batch of formatted lines to `url`. Swap in a fake for tests. */
924
+ type Sender = (url: string, batch: readonly string[]) => Promise<void> | void;
925
+ interface HTTPTransportOptions {
926
+ formatter?: Formatter;
927
+ batchSize?: number;
928
+ sender?: Sender;
929
+ }
930
+ /**
931
+ * Batches formatted records and POSTs them as newline-delimited JSON via `fetch`.
932
+ * Pass `sender` to swap in a fake for tests, or a different backend.
933
+ */
934
+ declare class HTTPTransport extends Transport {
935
+ readonly url: string;
936
+ readonly batchSize: number;
937
+ private readonly sender;
938
+ private batch;
939
+ constructor(url: string, options?: HTTPTransportOptions);
940
+ write(formatted: string): void;
941
+ /** Send the current batch now, even if it hasn't reached `batchSize`. */
942
+ flush(): void;
943
+ close(): void;
944
+ }
945
+
946
+ interface LoggerOptions {
947
+ level?: LevelInput;
948
+ transports?: Transport[];
949
+ plugins?: Plugin[];
950
+ meta?: Record<string, unknown>;
951
+ }
952
+ declare class Logger {
953
+ readonly name: string;
954
+ readonly transports: Transport[];
955
+ readonly plugins: Plugin[];
956
+ private currentLevel;
957
+ private readonly baseMeta;
958
+ constructor(name: string, options?: LoggerOptions);
959
+ get level(): Level;
960
+ setLevel(level: LevelInput): void;
961
+ /** Register a plugin. Returns `this` so calls can be chained. */
962
+ use(plugin: Plugin): this;
963
+ /** Close every attached transport. Call on shutdown to flush buffered writes. */
964
+ close(): void;
965
+ /** A logger scoped under this one, inheriting its level, transports, and plugins. */
966
+ child(name: string, meta?: Record<string, unknown>): Logger;
967
+ private notifyError;
968
+ private dispatch;
969
+ trace(message: string, meta?: Record<string, unknown>): LogRecord | null;
970
+ debug(message: string, meta?: Record<string, unknown>): LogRecord | null;
971
+ info(message: string, meta?: Record<string, unknown>): LogRecord | null;
972
+ warn(message: string, meta?: Record<string, unknown>): LogRecord | null;
973
+ error(message: string, meta?: Record<string, unknown>): LogRecord | null;
974
+ fatal(message: string, meta?: Record<string, unknown>): LogRecord | null;
975
+ }
976
+
977
+ declare const VERSION = "0.2.0";
978
+
979
+ export { type AmqpChannelLike, type AppInsightsClientLike, type AppInsightsTrace, AppInsightsTransport, type AppInsightsTransportOptions, BaseQueueTransport, type BaseQueueTransportOptions, BaseSQLTransport, type BaseSQLTransportOptions, BatchingTransport, type BatchingTransportOptions, type CloudLoggingClientLike, type CloudLoggingEntry, CloudLoggingTransport, type CloudLoggingTransportOptions, type CloudWatchClientLike, type CloudWatchLogEvent, CloudWatchTransport, type CloudWatchTransportOptions, CollectingTransport, type ConsoleLike, ConsoleTransport, type ConsoleTransportOptions, ContextPlugin, DEFAULT_REDACTED_KEYS, type DatadogSender, DatadogTransport, type DatadogTransportOptions, type DynamoClientLike, DynamoDBTransport, type DynamoDBTransportOptions, type DynamoLogItem, type ElasticsearchSender, ElasticsearchTransport, type ElasticsearchTransportOptions, FileTransport, type FileTransportOptions, type Formatter, HTTPTransport, type HTTPTransportOptions, JSONFormatter, type KafkaProducerLike, KafkaTransport, type KafkaTransportOptions, Level, type LevelInput, type LogRecord, Logger, type LoggerOptions, type MongoClientLike, type MongoCollectionLike, MongoDBTransport, type MongoDBTransportOptions, type MySQLClientLike, MySQLTransport, type MySQLTransportOptions, type NewRelicRegion, type NewRelicSender, type NewRelicSenderResult, NewRelicTransport, type NewRelicTransportOptions, type PgClientLike, type Plugin, PostgresTransport, type PostgresTransportOptions, type PubSubTopicLike, PubSubTransport, type PubSubTransportOptions, RabbitMQTransport, type RabbitMQTransportOptions, RedactPlugin, type RedactPluginOptions, type RedisClientLike, RedisTransport, type RedisTransportOptions, type SQLLogRow, type SQLiteClientLike, type SQLiteStatementLike, SQLiteTransport, type SQLiteTransportOptions, type SQSClientLike, SQSTransport, type SQSTransportOptions, SamplingPlugin, type SamplingPluginOptions, type Sender, Transport, VERSION, createRecord, levelName, parseLevel, utcTimestamp };