@visulima/pail 4.0.0-alpha.9 → 4.0.1

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.
Files changed (145) hide show
  1. package/CHANGELOG.md +519 -0
  2. package/LICENSE.md +270 -166
  3. package/README.md +53 -24
  4. package/dist/error.d.ts +95 -96
  5. package/dist/error.js +5 -76
  6. package/dist/index.browser.d.ts +568 -47
  7. package/dist/index.browser.js +19 -1499
  8. package/dist/index.server.d.ts +749 -65
  9. package/dist/index.server.js +32 -3179
  10. package/dist/middleware/elysia.d.ts +66 -63
  11. package/dist/middleware/elysia.js +1 -70
  12. package/dist/middleware/express.d.ts +74 -71
  13. package/dist/middleware/express.js +1 -29
  14. package/dist/middleware/fastify.d.ts +70 -67
  15. package/dist/middleware/fastify.js +1 -46
  16. package/dist/middleware/hono.d.ts +75 -72
  17. package/dist/middleware/hono.js +1 -33
  18. package/dist/middleware/next/handler.d.ts +102 -34
  19. package/dist/middleware/next/handler.js +1 -53
  20. package/dist/middleware/sveltekit.d.ts +101 -98
  21. package/dist/middleware/sveltekit.js +1 -43
  22. package/dist/object-tree.d.ts +67 -70
  23. package/dist/object-tree.js +2 -89
  24. package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +1 -0
  25. package/dist/packem_shared/AbstractJsonReporter-w_bGGiD-.js +1 -0
  26. package/dist/packem_shared/JsonReporter-Sd_lJGS-.js +2 -0
  27. package/dist/packem_shared/JsonReporter-bmem9lcg.js +1 -0
  28. package/dist/packem_shared/PailError-CbU1Ogfa.js +5 -0
  29. package/dist/packem_shared/PrettyReporter-CcDdPQSt.js +44 -0
  30. package/dist/packem_shared/PrettyReporter-DsHfKOU7.js +5 -0
  31. package/dist/packem_shared/abstract-json-reporter.d-wfESoEa-.d.ts +62 -0
  32. package/dist/packem_shared/abstract-pretty-reporter-DrLBJ6ds.js +57 -0
  33. package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js +25 -0
  34. package/dist/packem_shared/constants-DKfCaSUR.js +1 -0
  35. package/dist/packem_shared/constants-ep2nsfdy.js +1 -0
  36. package/dist/packem_shared/create-middleware-logger.d-B-JmQ1Sl.d.ts +47 -0
  37. package/dist/packem_shared/headers-DH0H2s8W.js +1 -0
  38. package/dist/packem_shared/index-Q1764hvO.js +1 -0
  39. package/dist/packem_shared/index.d-T71KjNAr.d.ts +16 -0
  40. package/dist/packem_shared/pailMiddleware-B5DJoBYl.js +1 -0
  41. package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +1 -0
  42. package/dist/packem_shared/storage-DaXAlpiO.js +1 -0
  43. package/dist/packem_shared/types.d-Cz9S7jZh.d.ts +201 -0
  44. package/dist/packem_shared/types.d-bWnqHJKL.d.ts +211 -0
  45. package/dist/packem_shared/types.d-xxE3FOD3.d.ts +229 -0
  46. package/dist/packem_shared/useLogger-DB34CuU5.js +1 -0
  47. package/dist/packem_shared/wide-event.d-D3ATYpoK.d.ts +717 -0
  48. package/dist/packem_shared/write-console-log-based-on-level-BqjxV016.js +1 -0
  49. package/dist/packem_shared/write-stream-C7jxLxIT.js +1 -0
  50. package/dist/processor/caller/caller-processor.d.ts +50 -47
  51. package/dist/processor/caller/caller-processor.js +1 -59
  52. package/dist/processor/environment-processor.d.ts +114 -113
  53. package/dist/processor/environment-processor.js +1 -78
  54. package/dist/processor/message-formatter-processor.d.ts +59 -49
  55. package/dist/processor/message-formatter-processor.js +1 -713
  56. package/dist/processor/opentelemetry-processor.d.ts +70 -66
  57. package/dist/processor/opentelemetry-processor.js +1 -52
  58. package/dist/processor/redact-processor.d.ts +99 -41
  59. package/dist/processor/redact-processor.js +1 -30
  60. package/dist/processor/sampling-processor.d.ts +103 -101
  61. package/dist/processor/sampling-processor.js +1 -59
  62. package/dist/reporter/file/json-file-reporter.d.ts +109 -42
  63. package/dist/reporter/file/json-file-reporter.js +2 -136
  64. package/dist/reporter/http/abstract-http-reporter.d.ts +256 -211
  65. package/dist/reporter/http/abstract-http-reporter.js +2 -435
  66. package/dist/reporter/http/http-reporter.d.ts +41 -36
  67. package/dist/reporter/http/http-reporter.edge-light.d.ts +487 -39
  68. package/dist/reporter/http/http-reporter.edge-light.js +2 -733
  69. package/dist/reporter/http/http-reporter.js +1 -13
  70. package/dist/reporter/json/index.browser.d.ts +98 -3
  71. package/dist/reporter/json/index.browser.js +1 -2
  72. package/dist/reporter/json/index.d.ts +53 -3
  73. package/dist/reporter/json/index.js +1 -2
  74. package/dist/reporter/pretty/index.browser.d.ts +105 -2
  75. package/dist/reporter/pretty/index.browser.js +1 -1
  76. package/dist/reporter/pretty/index.d.ts +270 -2
  77. package/dist/reporter/pretty/index.js +1 -1
  78. package/dist/reporter/simple/simple-reporter.server.d.ts +215 -18
  79. package/dist/reporter/simple/simple-reporter.server.js +8 -182
  80. package/dist/wide-event.d.ts +6 -300
  81. package/dist/wide-event.js +1 -281
  82. package/package.json +43 -58
  83. package/dist/constants.d.ts +0 -37
  84. package/dist/interactive/index.d.ts +0 -2
  85. package/dist/interactive/index.js +0 -2
  86. package/dist/interactive/interactive-manager.d.ts +0 -108
  87. package/dist/interactive/interactive-stream-hook.d.ts +0 -68
  88. package/dist/middleware/next/middleware.d.ts +0 -59
  89. package/dist/middleware/next/storage.d.ts +0 -14
  90. package/dist/middleware/shared/create-middleware-logger.d.ts +0 -82
  91. package/dist/middleware/shared/headers.d.ts +0 -14
  92. package/dist/middleware/shared/routes.d.ts +0 -30
  93. package/dist/middleware/shared/storage.d.ts +0 -29
  94. package/dist/packem_shared/AbstractJsonReporter-CGKHS8_M.js +0 -286
  95. package/dist/packem_shared/AbstractJsonReporter-DDjDkciI.js +0 -286
  96. package/dist/packem_shared/InteractiveManager-Cd6A14ZK.js +0 -172
  97. package/dist/packem_shared/InteractiveStreamHook-ePIURL_U.js +0 -133
  98. package/dist/packem_shared/JsonReporter-B3XX8GHN.js +0 -58
  99. package/dist/packem_shared/JsonReporter-p_BXg6Sj.js +0 -28
  100. package/dist/packem_shared/PrettyReporter-BYL3NrdA.js +0 -214
  101. package/dist/packem_shared/PrettyReporter-CvBn-hxP.js +0 -1459
  102. package/dist/packem_shared/Spinner-DIdVcfWq.js +0 -2183
  103. package/dist/packem_shared/abstract-pretty-reporter-jU8WL_6c.js +0 -2602
  104. package/dist/packem_shared/constants-B1RjD_ps.js +0 -99
  105. package/dist/packem_shared/constants-omsTHUWB.js +0 -119
  106. package/dist/packem_shared/createPailError-B11aRfrT.js +0 -76
  107. package/dist/packem_shared/getBarChar-BWj1UrH3.js +0 -404
  108. package/dist/packem_shared/headers-Cp4uLtr4.js +0 -123
  109. package/dist/packem_shared/index-DnkF86LQ.js +0 -658
  110. package/dist/packem_shared/index-frijFf5m.js +0 -1252
  111. package/dist/packem_shared/pailMiddleware-Ci88geIF.js +0 -24
  112. package/dist/packem_shared/storage-D0vqz8OX.js +0 -36
  113. package/dist/packem_shared/useLogger-D0rU3lcX.js +0 -33
  114. package/dist/packem_shared/write-console-log-based-on-level-DBmRYXpj.js +0 -14
  115. package/dist/packem_shared/write-stream-BG8fhcs3.js +0 -6
  116. package/dist/pail.browser.d.ts +0 -412
  117. package/dist/pail.server.d.ts +0 -233
  118. package/dist/processor/caller/get-caller-filename.d.ts +0 -23
  119. package/dist/progress-bar.d.ts +0 -136
  120. package/dist/progress-bar.js +0 -404
  121. package/dist/reporter/file/utils/rotating-file-stream.d.ts +0 -48
  122. package/dist/reporter/http/utils/compression.d.ts +0 -7
  123. package/dist/reporter/http/utils/log-size-error.d.ts +0 -30
  124. package/dist/reporter/http/utils/retry.d.ts +0 -27
  125. package/dist/reporter/json/abstract-json-reporter.d.ts +0 -61
  126. package/dist/reporter/json/json-reporter.browser.d.ts +0 -40
  127. package/dist/reporter/json/json-reporter.server.d.ts +0 -50
  128. package/dist/reporter/pretty/abstract-pretty-reporter.d.ts +0 -83
  129. package/dist/reporter/pretty/pretty-reporter.browser.d.ts +0 -36
  130. package/dist/reporter/pretty/pretty-reporter.server.d.ts +0 -70
  131. package/dist/reporter/raw/raw-reporter.browser.d.ts +0 -5
  132. package/dist/reporter/raw/raw-reporter.server.d.ts +0 -13
  133. package/dist/reporter/utils/default-inspector-config.d.ts +0 -3
  134. package/dist/reporter/utils/format-label.d.ts +0 -3
  135. package/dist/spinner.d.ts +0 -220
  136. package/dist/spinner.js +0 -2183
  137. package/dist/types.d.ts +0 -241
  138. package/dist/utils/ansi-escapes.d.ts +0 -4
  139. package/dist/utils/arrayify.d.ts +0 -2
  140. package/dist/utils/get-longest-badge.d.ts +0 -4
  141. package/dist/utils/get-longest-label.d.ts +0 -4
  142. package/dist/utils/merge-types.d.ts +0 -4
  143. package/dist/utils/stream/safe-stream-handler.d.ts +0 -21
  144. package/dist/utils/write-console-log-based-on-level.d.ts +0 -4
  145. package/dist/utils/write-stream.d.ts +0 -2
@@ -1,215 +1,260 @@
1
- import type { LiteralUnion } from "type-fest";
2
- import type { ExtendedRfc5424LogLevels, StringifyAwareReporter } from "../../types.d.ts";
3
- import type { AbstractJsonReporterOptions } from "../json/abstract-json-reporter.d.ts";
4
- import { AbstractJsonReporter } from "../json/abstract-json-reporter.d.ts";
1
+ import { LiteralUnion } from 'type-fest';
2
+ import { E as ExtendedRfc5424LogLevels, S as StringifyAwareReporter } from "../../packem_shared/types.d-bWnqHJKL.js";
3
+ import { A as AbstractJsonReporterOptions, a as AbstractJsonReporter } from "../../packem_shared/abstract-json-reporter.d-wfESoEa-.js";
4
+ import '@visulima/colorize';
5
+ import '@visulima/interactive-manager';
6
+ import "../../packem_shared/index.d-T71KjNAr.js";
5
7
  /**
6
- * Configuration options for the HTTP reporter.
7
- */
8
- export type AbstractHttpReporterOptions = AbstractJsonReporterOptions & {
9
- /**
10
- * Content type for batch log requests. User-specified headers take precedence.
11
- * @default "application/json"
12
- */
13
- batchContentType?: string;
14
- /**
15
- * Field name to wrap batch entries in when batchMode is "field" (e.g., "batch" for Logflare)
16
- * @default undefined
17
- */
18
- batchFieldName?: string;
19
- /**
20
- * Batch mode for sending multiple log entries
21
- * - "delimiter": Join entries with a delimiter (default)
22
- * - "field": Wrap entries in an object with a field name
23
- * - "array": Send entries as a plain JSON array
24
- * @default "delimiter"
25
- */
26
- batchMode?: "delimiter" | "field" | "array";
27
- /**
28
- * Delimiter to use between log entries in batch mode
29
- * @default "\n"
30
- */
31
- batchSendDelimiter?: string;
32
- /**
33
- * Timeout in milliseconds for sending batches regardless of size
34
- * @default 5000
35
- */
36
- batchSendTimeout?: number;
37
- /**
38
- * Number of log entries to batch before sending
39
- * @default 100
40
- */
41
- batchSize?: number;
42
- /**
43
- * Whether to use gzip compression
44
- * @default false
45
- */
46
- compression?: boolean;
47
- /**
48
- * Content type for single log requests. User-specified headers take precedence.
49
- * @default "application/json"
50
- */
51
- contentType?: string;
52
- /**
53
- * Whether to enable Edge Runtime compatibility mode
54
- * When enabled, TextEncoder and compression are disabled
55
- * @default false
56
- */
57
- edgeCompat?: boolean;
58
- /**
59
- * Whether to enable batch sending
60
- * @default true
61
- */
62
- enableBatchSend?: boolean;
63
- /**
64
- * Headers to include in the request. Can be an object or a function that returns headers.
65
- */
66
- headers?: Record<string, string> | (() => Record<string, string>);
67
- /**
68
- * Maximum size of a single log entry in bytes
69
- * @default 1048576 (1MB)
70
- */
71
- maxLogSize?: number;
72
- /**
73
- * Maximum size of the payload (uncompressed) in bytes
74
- * @default 5242880 (5MB)
75
- */
76
- maxPayloadSize?: number;
77
- /**
78
- * Number of retry attempts before giving up
79
- * @default 3
80
- */
81
- maxRetries?: number;
82
- /**
83
- * HTTP method to use for requests
84
- * @default "POST"
85
- */
86
- method?: string;
87
- /**
88
- * Optional callback for debugging log entries before they are sent
89
- */
90
- onDebug?: (entry: Record<string, unknown>) => void;
91
- /**
92
- * Optional callback for debugging HTTP requests and responses
93
- */
94
- onDebugRequestResponse?: (requestResponse: {
95
- req: {
96
- body: string | Uint8Array;
97
- headers: Record<string, string>;
98
- method: string;
99
- url: string;
100
- };
101
- res: {
102
- body: string;
103
- headers: Record<string, string>;
104
- status: number;
105
- statusText: string;
106
- };
107
- }) => void;
108
- /**
109
- * Optional callback for error handling
110
- */
111
- onError?: (error: Error) => void;
112
- /**
113
- * Function to transform log data into the payload format.
114
- * By default, uses the JSON stringified log entry.
115
- */
116
- payloadTemplate?: (data: {
117
- data?: Record<string, unknown>;
118
- logLevel: string;
119
- message: string;
120
- }) => string;
121
- /**
122
- * Whether to respect rate limiting by waiting when a 429 response is received
123
- * @default true
124
- */
125
- respectRateLimit?: boolean;
126
- /**
127
- * Base delay between retries in milliseconds
128
- * @default 1000
129
- */
130
- retryDelay?: number;
131
- /**
132
- * The URL to send logs to
133
- */
134
- url: string;
8
+ * Configuration options for the HTTP reporter.
9
+ */
10
+ type AbstractHttpReporterOptions = AbstractJsonReporterOptions & {
11
+ /**
12
+ * Content type for batch log requests. User-specified headers take precedence.
13
+ * @default "application/json"
14
+ */
15
+ batchContentType?: string;
16
+ /**
17
+ * Field name to wrap batch entries in when batchMode is "field" (e.g., "batch" for Logflare)
18
+ * @default undefined
19
+ */
20
+ batchFieldName?: string;
21
+ /**
22
+ * Batch mode for sending multiple log entries
23
+ * - "delimiter": Join entries with a delimiter (default)
24
+ * - "field": Wrap entries in an object with a field name
25
+ * - "array": Send entries as a plain JSON array
26
+ * @default "delimiter"
27
+ */
28
+ batchMode?: "delimiter" | "field" | "array";
29
+ /**
30
+ * Delimiter to use between log entries in batch mode
31
+ * @default "\n"
32
+ */
33
+ batchSendDelimiter?: string;
34
+ /**
35
+ * Timeout in milliseconds for sending batches regardless of size
36
+ * @default 5000
37
+ */
38
+ batchSendTimeout?: number;
39
+ /**
40
+ * Number of log entries to batch before sending
41
+ * @default 100
42
+ */
43
+ batchSize?: number;
44
+ /**
45
+ * Whether to use gzip compression
46
+ * @default false
47
+ */
48
+ compression?: boolean;
49
+ /**
50
+ * Content type for single log requests. User-specified headers take precedence.
51
+ * @default "application/json"
52
+ */
53
+ contentType?: string;
54
+ /**
55
+ * Whether to enable Edge Runtime compatibility mode
56
+ * When enabled, TextEncoder and compression are disabled
57
+ * @default false
58
+ */
59
+ edgeCompat?: boolean;
60
+ /**
61
+ * Whether to enable batch sending
62
+ * @default true
63
+ */
64
+ enableBatchSend?: boolean;
65
+ /**
66
+ * Headers to include in the request. Can be an object or a function that returns headers.
67
+ */
68
+ headers?: Record<string, string> | (() => Record<string, string>);
69
+ /**
70
+ * Maximum size of a single log entry in bytes
71
+ * @default 1048576 (1MB)
72
+ */
73
+ maxLogSize?: number;
74
+ /**
75
+ * Maximum size of the payload (uncompressed) in bytes
76
+ * @default 5242880 (5MB)
77
+ */
78
+ maxPayloadSize?: number;
79
+ /**
80
+ * Maximum number of entries to keep queued while the endpoint is unavailable.
81
+ * When the queue exceeds this limit, the oldest entries are dropped (drop-oldest)
82
+ * so a sustained outage cannot grow memory without bound.
83
+ * @default 10000
84
+ */
85
+ maxQueueSize?: number;
86
+ /**
87
+ * Number of retry attempts before giving up
88
+ * @default 3
89
+ */
90
+ maxRetries?: number;
91
+ /**
92
+ * HTTP method to use for requests
93
+ * @default "POST"
94
+ */
95
+ method?: string;
96
+ /**
97
+ * Optional callback for debugging log entries before they are sent
98
+ */
99
+ onDebug?: (entry: Record<string, unknown>) => void;
100
+ /**
101
+ * Optional callback for debugging HTTP requests and responses
102
+ */
103
+ onDebugRequestResponse?: (requestResponse: {
104
+ req: {
105
+ body: string | Uint8Array;
106
+ headers: Record<string, string>;
107
+ method: string;
108
+ url: string;
109
+ };
110
+ res: {
111
+ body: string;
112
+ headers: Record<string, string>;
113
+ status: number;
114
+ statusText: string;
115
+ };
116
+ }) => void;
117
+ /**
118
+ * Optional callback invoked when queued log entries are dropped because the queue
119
+ * exceeded `maxQueueSize`. Receives the number of dropped entries.
120
+ */
121
+ onDrop?: (droppedCount: number) => void;
122
+ /**
123
+ * Optional callback for error handling
124
+ */
125
+ onError?: (error: Error) => void;
126
+ /**
127
+ * Function to transform log data into the payload format.
128
+ * By default, uses the JSON stringified log entry.
129
+ */
130
+ payloadTemplate?: (data: {
131
+ data?: Record<string, unknown>;
132
+ logLevel: string;
133
+ message: string;
134
+ }) => string;
135
+ /**
136
+ * Whether to respect rate limiting by waiting when a 429 response is received
137
+ * @default true
138
+ */
139
+ respectRateLimit?: boolean;
140
+ /**
141
+ * Base delay between retries in milliseconds
142
+ * @default 1000
143
+ */
144
+ retryDelay?: number;
145
+ /**
146
+ * The URL to send logs to
147
+ */
148
+ url: string;
135
149
  };
136
150
  /**
137
- * Abstract HTTP Reporter.
138
- *
139
- * Base class for HTTP-based reporters that sends logs to HTTP endpoints.
140
- * Supports batching, compression, retries, and rate limiting.
141
- * @template L - The log level type
142
- */
143
- export declare abstract class AbstractHttpReporter<L extends string = string> extends AbstractJsonReporter<L> implements StringifyAwareReporter<L> {
144
- protected url: string;
145
- protected method: string;
146
- protected headers: Record<string, string> | (() => Record<string, string>);
147
- protected contentType: string;
148
- protected batchContentType: string;
149
- protected onError?: (error: Error) => void;
150
- protected onDebug?: (entry: Record<string, unknown>) => void;
151
- protected onDebugRequestResponse?: (requestResponse: {
152
- req: {
153
- body: string | Uint8Array;
154
- headers: Record<string, string>;
155
- method: string;
156
- url: string;
157
- };
158
- res: {
159
- body: string;
160
- headers: Record<string, string>;
161
- status: number;
162
- statusText: string;
163
- };
164
- }) => void;
165
- protected payloadTemplate: (data: {
166
- data?: Record<string, unknown>;
167
- logLevel: string;
168
- message: string;
169
- }) => string;
170
- protected compression: boolean;
171
- protected maxRetries: number;
172
- protected retryDelay: number;
173
- protected respectRateLimit: boolean;
174
- protected enableBatchSend: boolean;
175
- protected batchSize: number;
176
- protected batchSendTimeout: number;
177
- protected batchSendDelimiter: string;
178
- protected batchMode: "delimiter" | "field" | "array";
179
- protected batchFieldName?: string;
180
- protected maxLogSize: number;
181
- protected maxPayloadSize: number;
182
- protected edgeCompat: boolean;
183
- protected batchQueue: string[];
184
- protected batchTimeout?: ReturnType<typeof setTimeout>;
185
- protected isProcessingBatch: boolean;
186
- protected currentBatchSize: number;
187
- /**
188
- * Creates a new instance of AbstractHttpReporter.
189
- * @param config Configuration options for the reporter
190
- */
191
- constructor(config: AbstractHttpReporterOptions);
192
- /**
193
- * Processes and ships log entries to the HTTP endpoint.
194
- * @param message The JSON-formatted log message
195
- * @param logLevel The log level of the message
196
- * @protected
197
- */
198
- protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
199
- /**
200
- * Adds a payload to the batch queue and triggers sending if conditions are met.
201
- */
202
- protected addToBatch(payload: string, logEntrySize: number): void;
203
- /**
204
- * Processes the current batch and sends it to the HTTP endpoint.
205
- */
206
- protected processBatch(): Promise<void>;
207
- /**
208
- * Sends a batch of payloads to the HTTP endpoint.
209
- */
210
- protected sendBatch(batch: string[]): Promise<void>;
211
- /**
212
- * Sends a single payload to the HTTP endpoint.
213
- */
214
- protected sendPayload(payload: string, contentType?: string): Promise<void>;
151
+ * Abstract HTTP Reporter.
152
+ *
153
+ * Base class for HTTP-based reporters that sends logs to HTTP endpoints.
154
+ * Supports batching, compression, retries, and rate limiting.
155
+ * @template L - The log level type
156
+ */
157
+ declare abstract class AbstractHttpReporter<L extends string = string> extends AbstractJsonReporter<L> implements StringifyAwareReporter<L> {
158
+ #private;
159
+ protected url: string;
160
+ protected method: string;
161
+ protected headers: Record<string, string> | (() => Record<string, string>);
162
+ protected contentType: string;
163
+ protected batchContentType: string;
164
+ protected onError?: (error: Error) => void;
165
+ protected onDrop?: (droppedCount: number) => void;
166
+ protected maxQueueSize: number;
167
+ protected onDebug?: (entry: Record<string, unknown>) => void;
168
+ protected onDebugRequestResponse?: (requestResponse: {
169
+ req: {
170
+ body: string | Uint8Array;
171
+ headers: Record<string, string>;
172
+ method: string;
173
+ url: string;
174
+ };
175
+ res: {
176
+ body: string;
177
+ headers: Record<string, string>;
178
+ status: number;
179
+ statusText: string;
180
+ };
181
+ }) => void;
182
+ protected payloadTemplate: (data: {
183
+ data?: Record<string, unknown>;
184
+ logLevel: string;
185
+ message: string;
186
+ }) => string;
187
+ protected compression: boolean;
188
+ protected maxRetries: number;
189
+ protected retryDelay: number;
190
+ protected respectRateLimit: boolean;
191
+ protected enableBatchSend: boolean;
192
+ protected batchSize: number;
193
+ protected batchSendTimeout: number;
194
+ protected batchSendDelimiter: string;
195
+ protected batchMode: "delimiter" | "field" | "array";
196
+ protected batchFieldName?: string;
197
+ protected maxLogSize: number;
198
+ protected maxPayloadSize: number;
199
+ protected edgeCompat: boolean;
200
+ protected batchQueue: string[];
201
+ protected batchTimeout?: ReturnType<typeof setTimeout>;
202
+ protected isProcessingBatch: boolean;
203
+ protected currentBatchSize: number;
204
+ /**
205
+ * Creates a new instance of AbstractHttpReporter.
206
+ * @param config Configuration options for the reporter
207
+ */
208
+ constructor(config: AbstractHttpReporterOptions);
209
+ /**
210
+ * Flushes all queued log entries to the HTTP endpoint immediately.
211
+ *
212
+ * Returns a promise that resolves once the queue has been drained (or rejects
213
+ * if a batch send fails terminally). Use this before a serverless function or
214
+ * short-lived process exits so the tail of the batch is not lost.
215
+ * @example
216
+ * ```typescript
217
+ * await reporter.flush();
218
+ * ```
219
+ */
220
+ flush(): Promise<void>;
221
+ /**
222
+ * Flushes any remaining queued entries and clears pending timers.
223
+ *
224
+ * Counterpart to a transport lifecycle `end`/`dispose`. After calling `close()`
225
+ * the reporter can still be used, but any pending batch timeout is cleared.
226
+ * @example
227
+ * ```typescript
228
+ * process.on("beforeExit", () => reporter.close());
229
+ * ```
230
+ */
231
+ close(): Promise<void>;
232
+ /**
233
+ * Alias for {@link close} to match common transport `dispose` conventions.
234
+ */
235
+ dispose(): Promise<void>;
236
+ /**
237
+ * Processes and ships log entries to the HTTP endpoint.
238
+ * @param message The JSON-formatted log message
239
+ * @param logLevel The log level of the message
240
+ * @protected
241
+ */
242
+ protected override _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
243
+ /**
244
+ * Adds a payload to the batch queue and triggers sending if conditions are met.
245
+ */
246
+ protected addToBatch(payload: string, logEntrySize: number): void;
247
+ /**
248
+ * Processes the current batch and sends it to the HTTP endpoint.
249
+ */
250
+ protected processBatch(): Promise<void>;
251
+ /**
252
+ * Sends a batch of payloads to the HTTP endpoint.
253
+ */
254
+ protected sendBatch(batch: string[]): Promise<void>;
255
+ /**
256
+ * Sends a single payload to the HTTP endpoint.
257
+ */
258
+ protected sendPayload(payload: string, contentType?: string): Promise<void>;
215
259
  }
260
+ export { AbstractHttpReporter, AbstractHttpReporterOptions };