Skip to main content

log

@rotorsoft/act-root


@rotorsoft/act-root / act/src / log

Variable: log

const log: (adapter?) => Logger | ConsoleLogger

Defined in: libs/act/src/ports.ts:136

Gets or injects the singleton logger.

By default, Act uses a built-in ConsoleLogger that emits JSON lines in production (compatible with GCP, AWS CloudWatch, Datadog) and colorized output in development โ€” zero external dependencies.

For pino, inject a PinoLogger from @rotorsoft/act-pino before building your application.

Parametersโ€‹

adapter?โ€‹

Logger | ConsoleLogger

Optional logger implementation to inject

Returnsโ€‹

Logger | ConsoleLogger

The singleton logger instance

Examplesโ€‹

import { log } from "@rotorsoft/act";
const logger = log();
logger.info("Application started");
import { log } from "@rotorsoft/act";
import { PinoLogger } from "@rotorsoft/act-pino";
log(new PinoLogger({ level: "debug", pretty: true }));

Seeโ€‹