Skip to content
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

fix: use logger more #36

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
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: 2 additions & 2 deletions site/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
## Features

- **Multi-Provider Deployment**: Deploy your web app simultaneously on multiple IPFS providers, including [web3.storage](https://web3.storage), [Gateway3](https://gw3.app) and [Filebase](https://filebase.com).
- **ENS and DNSLink Integration**: Seamlessly integrate with [ENS](https://ens.domains) and [DNSLink](https://dnslink.dev) to update your Content-Hash, making it easier for users to access your web app via ENS gateways.
- **Safe Integration**: Add an extra layer of security and decentralization with [Safe](https://safe.global) multi-sig.
- **ENS and DNSLink Integration**: Seamlessly integrate with [ENS](https://ens.domains) and [DNSLink](https://dnslink.dev) to update your decentralized website.
- **Safe Integration**: Add an extra layer of security and decentralization with a [Safe](https://safe.global) multi-sig.

## Installation

Expand Down
10 changes: 7 additions & 3 deletions src/actions/ping.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as colors from 'colorette'
import { isTTY } from '../constants'
import { logger } from '../utils/logger'

let retryCount = 0

Expand All @@ -16,7 +17,10 @@ export const pingAction = async (

retryCount++
const url = `https://${cid}.ipfs.${endpoint}`
console.log(`${isTTY ? colors.bold(`[${retryCount}]`) : `[${retryCount}]`}: Requesting content at ${url}`)
console.log(`${isTTY
? `${colors.bold(`[${retryCount}]`)}: Requesting content at ${url}`
: `[${retryCount}]`}: Requesting content at ${url}`,
)
try {
const response = await fetch(url, { signal: AbortSignal.timeout(timeout), redirect: 'follow' })
if (response.status === 504) {
Expand All @@ -32,7 +36,7 @@ export const pingAction = async (
else {
return console.log(`Gateway status: ${
response.status >= 200 && response.status < 400
? (isTTY ? colors.bold(colors.green(`Online ${response.status}`)) : `Online ${response.status}`)
? logger.info((isTTY ? colors.bold(colors.green(`Online ${response.status}`)) : `Online ${response.status}`))
: response.status
}`)
}
Expand All @@ -47,7 +51,7 @@ export const pingAction = async (
return console.error(gwOfflineMessage)
}
}
console.error('Error fetching endpoint:', (error as Error).message)
logger.error('Error fetching endpoint:', (error as Error).message)
throw error
}
}
Loading