Basic Usage
Root logger
The root logger export is a proxy around a default standalone logger instance.
import { logger } from "blyp-js";
logger.info("server started");
logger.success("worker ready");
logger.warning("cache is stale");
logger.error("queue processing failed");
logger.critical("database unavailable");
logger.debug("request trace");Structured messages and metadata
Every log method accepts a message and optional extra arguments.
logger.info("user login", {
userId: "usr_123",
tenantId: "tenant_456",
});
logger.table("feature flags", {
betaCheckout: true,
useEdgeCache: false,
});Child loggers
Use child() when you want stable bindings on every log line.
const paymentsLog = logger.child({
service: "payments",
region: "eu-west-1",
});
paymentsLog.info("authorized");
paymentsLog.error("capture failed", { provider: "stripe" });Dedicated standalone instances
If you need a logger with different level, output directory, or file options, create an instance explicitly.
import { createStandaloneLogger } from "blyp-js";
const log = createStandaloneLogger({
level: "debug",
pretty: true,
logDir: "logs/payments",
clientLogging: {
enabled: true,
path: "/client-logs",
},
});
log.info("standalone logger ready");Root import vs blyp-js/standalone
Both of these are valid:
import { logger, createStandaloneLogger } from "blyp-js";import type { StandaloneLogger, StandaloneLoggerConfig } from "blyp-js/standalone";Use the root import for app code and the subpath import when you specifically want standalone type surfaces.