Skip to main content
Home

Built and signed on GitHub Actions

It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
88%
Published
2 days ago (0.2.7)

Unified logging interface for Probitas packages.

This package provides a centralized logging system built on LogTape. It offers consistent logging across all Probitas packages with configurable log levels, pretty formatting, and hierarchical categories.

All Probitas packages use this logger internally: @probitas/runner, @probitas/reporter, @probitas/discover, @probitas/cli

Core Functions

Types

  • Logger - Logger interface from LogTape
  • LogLevel - Available log levels

Log Levels

From least to most verbose:

  • "fatal" - Critical errors that stop execution
  • "error" - Errors that don't stop execution
  • "warning" - Potential issues (default level)
  • "info" - Informational messages about execution
  • "debug" - Detailed debugging information

Category Hierarchy

Loggers use hierarchical categories following the package structure:

  • ["probitas"] - Root category for all Probitas logs
  • ["probitas", "runner"] - Runner package logs
  • ["probitas", "cli", "run"] - Specific command logs

Examples

Basic configuration

import { configureLogging, getLogger } from "@probitas/logger";

// Configure logging at startup
await configureLogging("info");

// Get a logger for your module
const logger = getLogger("probitas", "mymodule");

logger.info("Application started");
logger.debug("Debug details", { config: { ... } });
logger.error("Something went wrong", { error });

Adjusting log level dynamically

import { configureLogging } from "@probitas/logger";

// Start with minimal logging
await configureLogging("warning");

// Enable debug logs when troubleshooting
await configureLogging("debug");

Using in a Probitas package

import { getLogger } from "@probitas/logger";

// In @probitas/runner
const logger = getLogger("probitas", "runner");

logger.debug("Executing scenario", { name: scenario.name });
logger.info("Scenario completed", { status: "passed" });

Testing with logging reset

import { configureLogging, resetLogging } from "@probitas/logger";

Deno.test("my test", async () => {
  await configureLogging("fatal"); // Suppress logs during test

  // ... test code ...

  await resetLogging(); // Clean up
});
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@probitas/logger

Import symbol

import * as logger from "@probitas/logger";
or

Import directly with a jsr specifier

import * as logger from "jsr:@probitas/logger";

Add Package

pnpm i jsr:@probitas/logger
or (using pnpm 10.8 or older)
pnpm dlx jsr add @probitas/logger

Import symbol

import * as logger from "@probitas/logger";

Add Package

yarn add jsr:@probitas/logger
or (using Yarn 4.8 or older)
yarn dlx jsr add @probitas/logger

Import symbol

import * as logger from "@probitas/logger";

Add Package

vlt install jsr:@probitas/logger

Import symbol

import * as logger from "@probitas/logger";

Add Package

npx jsr add @probitas/logger

Import symbol

import * as logger from "@probitas/logger";

Add Package

bunx jsr add @probitas/logger

Import symbol

import * as logger from "@probitas/logger";