Skip to content

chore: better logging #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.22.0-1](https://github.com/microlinkhq/html-get/compare/v2.22.0-0...v2.22.0-1) (2025-04-12)

## [2.22.0-0](https://github.com/microlinkhq/html-get/compare/v2.21.3...v2.22.0-0) (2025-04-12)

### 2.21.3 (2025-04-12)

### 2.21.2 (2025-03-28)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "html-get",
"description": "Get the HTML from any website, fine-tuned for correction & speed",
"homepage": "https://nicedoc.com/microlinkhq/html-get",
"version": "2.21.3",
"version": "2.22.0-1",
"main": "src/index.js",
"bin": {
"html-get": "bin/index.js"
11 changes: 8 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -139,9 +139,10 @@ const prerender = PCancelable.fn(
async (page, response) => {
if (!response) throw new AbortError('empty response')

return {
const duration = debug.duration('payload')
const payload = {
headers: response.headers(),
html: await page.content(),
html: await page.content('html'),
mode: 'prerender',
url: response.url(),
statusCode: response.status(),
@@ -153,6 +154,9 @@ const prerender = PCancelable.fn(
url: req.url()
}))
}

duration()
return payload
},
{
timeout,
@@ -161,9 +165,10 @@ const prerender = PCancelable.fn(
}
)

const duration = debug.duration('prerender')
const payload = await getPayload(url, opts)
await fetchRes.cancel()
debug('prerender', { url, state: 'success' })
duration({ url, state: 'success' })
return payload
} catch (err) {
const { isRejected, ...dataProps } = await fetchRes