Blyp Docs

Utilities & Runtime

Runtime detection

import { runtime, createRuntimeAdapter, createLogDir } from "@blyp/core";

console.log(runtime.type);   // "bun" or "node"
console.log(runtime.isBun);  // boolean
console.log(runtime.isNode); // boolean

runtime exposes a RuntimeAdapter with:

Color helpers

import {
  getMethodColor,
  getStatusColor,
  getArrowForMethod,
  getResponseTimeColor,
  getColoredLevel,
  colors,
} from "@blyp/core";

These helpers power Blyp's pretty console output and are useful in custom CLIs or reporting tools.

Config helpers

import {
  DEFAULT_CONFIG,
  DEFAULT_CLIENT_LOGGING_CONFIG,
  DEFAULT_DATABASE_DELIVERY_CONFIG,
  DEFAULT_DATABASE_RETRY_CONFIG,
  DEFAULT_FILE_CONFIG,
  DEFAULT_ROTATION_CONFIG,
  getConfig,
  loadConfig,
  mergeBlypConfig,
  resolveConfig,
  resetConfigCache,
  type ResolvedBlypConfig,
} from "@blyp/core";

Use them when you want to inspect defaults, merge overrides manually, or reset config state in tests.

loadConfig(), resolveConfig(), and getConfig() return ResolvedBlypConfig, which means the returned object already has normalized destination, file, clientLogging, and connector/database state.

Database helpers

import {
  createDrizzleDatabaseAdapter,
  createPrismaDatabaseAdapter,
  type DatabaseAdapterConfig,
  type DatabaseDialect,
  type DatabaseLoggerConfig,
  type ResolvedDatabaseLoggerConfig,
} from "@blyp/core/database";

Use these when destination: "database" is the primary sink and you want typed adapter configuration for Prisma or Drizzle.

Structured log exports

The root package also exports the structured log helper and its public types:

import {
  createStructuredLog,
  type StructuredLog,
  type StructuredLogEmitOptions,
  type StructuredLogError,
  type StructuredLogEvent,
  type StructuredLogLevel,
  type StructuredLogPayload,
} from "@blyp/core";

Use these when you want to type helper functions around batched request logs, inspect emitted payloads in tests, or build wrappers on top of Blyp's structured logging flow.