A lightweight and elegant utility for sending error logs to the HuntGlitch logging service — built for React apps with support for both JavaScript and TypeScript.
- 🔁 Centralized error logging with promise-based feedback
- 🧠 Intelligently categorizes logs by severity
- ⚙️ Supports custom log levels (
debug
,info
,warning
,error
, etc.) - ⚡ Quick setup via
.env
keys - 📦 Supports both JavaScript & TypeScript projects
- 🌐 Lightweight for client-side usage in React apps
- 🔐 Secure delivery via HuntGlitch keys
npm install react-huntglitch
Create a .env
file in your project root:
PROJECT_KEY=your_project_key
DELIVERABLE_KEY=your_deliverable_key
🔐 You can find these keys in your HuntGlitch dashboard:
https://app.huntglitch.com
import Log from "react-huntglitch";
try {
throw new Error("Something went wrong!");
} catch (error) {
Log({
error,
logType: 5, // Optional, defaults to 5 (Error)
})
.then(() => console.log("✅ Log sent successfully."))
.catch(() => console.error("❌ Failed to send log."));
}
Prop | Type | Required | Description | Example |
---|---|---|---|---|
error |
object | ✅ | JavaScript error object to be logged | error |
logType |
number | ❌ | Log level: 1=debug , 2=warning , 3=notice , 4=info , 5=error
|
5 |
- Wrap all async operations and business logic in
try...catch
blocks. - Send contextual information (user IDs, request data, etc.) via enriched
Error
objects. - Use different
logType
values to categorize errors for better filtering in HuntGlitch.
Inspired by HuntGlitch — built to make error logging clean, centralized, and developer-friendly.
If you like this package, consider starring ⭐ the GitHub repo or sharing feedback!
MIT © HuntGlitch