Write createErrorReporter({ send, maxBatch = 10 }) returning { report, flush, pending }. report(error) accepts an Error or any value. Errors with the same name and message are one entry with a count, so a loop that throws 500 times sends one line. flush() calls send(batch) once with the entries in first-seen order (each { name, message, count }) and starts fresh; with nothing pending it does not call send. When the number of distinct entries reaches maxBatch, flush automatically. pending() returns the number of distinct entries waiting. A non-error value is reported with name "Error" and its string form as the message.