SDK
Sending Events
Send categorized, structured logs with dedicated helper methods for each log level.
Available Logger Methods
logger.info(payload)Standard application informational messages
logger.error(payload)Exceptions, failures, and unhandled rejections
logger.warning(payload)Degraded performance or deprecated actions
logger.metric(payload)Timings, memory, and performance statistics
logger.success(payload)Successful completions and operations
logger.audit(payload)Security and compliance audit trails
Usage Examples
app/api/auth/route.ts
typescriptimport { logger } from "@/lib/logger";
// 1. Audit user login
logger.audit({
message: "User logged in via OAuth (Google)",
service: "auth-service",
operation: "oauth_callback",
security: {
ip: req.headers.get("x-forwarded-for") || "127.0.0.1",
authStatus: "success",
},
track: { userId: user.id },
});
// 2. Log database query metrics
logger.metric({
message: "Fetched user analytics",
service: "analytics-api",
subsystem: "db",
metrics: { durationMs: 42, memoryUsageMb: 85 },
});Logging Errors with Importance
Attach an importance level (“critical”, “high”, “medium”, “low”) to trigger immediate alerts.
services/payment.ts
typescripttry {
await chargeCard(token, amount);
} catch (err: any) {
logger.error({
message: `Payment charge failed: ${err.message}`,
importance: "critical",
service: "billing-service",
subsystem: "network",
operation: "stripe_charge",
});
}