flushDebugLogs function is a utility for outputting debug logs to the console with colored output in development mode. This function is particularly useful for debugging and monitoring application behavior during development, providing visually distinct log entries with customizable color schemes.ts
import { flushDebugLogs } from "@arkyn/server";
name (required)stringscheme (required)"yellow" | "cyan" | "red" | "green"debugs (required)string[]DEBUG_MODE is enabled.typescript
import { flushDebugLogs } from "@arkyn/server";// Log API request informationflushDebugLogs({name: "API",scheme: "cyan",debugs: ["POST /api/users", "Status: 201", "Response time: 45ms"],});// Output:// [API] POST /api/users// [API] Status: 201// [API] Response time: 45ms
NODE_ENV is set to developmentDEBUG_MODE environment variable is set to truetypescript
// Logs will be displayed when:// - NODE_ENV=development// - DEBUG_MODE=true// Logs will NOT be displayed when:// - NODE_ENV=production (without DEBUG_MODE=true)// - NODE_ENV=test (without DEBUG_MODE=true)
DEBUG_MODE.void and does not throw any errors, making it safe to use in any context without error handling.