* Does a dispatch of a log record. * * @param {string[]} fields Log record. * @private
(fields)
| 215 | * @private |
| 216 | */ |
| 217 | async dispatchLogRow_(fields) { |
| 218 | // Obtain the dispatch. |
| 219 | const command = fields[0]; |
| 220 | const dispatch = this.dispatchTable_.get(command); |
| 221 | if (dispatch === undefined) return; |
| 222 | const parsers = dispatch.parsers; |
| 223 | const length = parsers.length; |
| 224 | // Parse fields. |
| 225 | const parsedFields = new Array(length); |
| 226 | for (let i = 0; i < length; ++i) { |
| 227 | const parser = parsers[i]; |
| 228 | if (parser === parseVarArgs) { |
| 229 | parsedFields[i] = fields.slice(1 + i); |
| 230 | break; |
| 231 | } else { |
| 232 | parsedFields[i] = parser(fields[1 + i]); |
| 233 | } |
| 234 | } |
| 235 | if (!this.useBigIntAddresses) { |
| 236 | if (!this.hasSeenUnsafeIntegers && containsUnsafeInts(parsedFields)) { |
| 237 | console.warn(`Log line contains unsafe integers: ${fields}`); |
| 238 | this.hasSeenUnsafeIntegers = true; |
| 239 | } |
| 240 | } |
| 241 | // Run the processor. |
| 242 | await dispatch.processor(...parsedFields); |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Processes log lines. |
no test coverage detected