Function critical

  • Log at the critical level.

    This function is a pass-through to the default logger's critical method. By default, the default logger is configured to use console.log and print in bold red text.

    Type Parameters

    • T

      The type of the message to log.

    Parameters

    • msg: (() => T)

      The message to log.

        • (): T
        • Returns T

    • Rest...args: unknown[]

      Arguments to be formatted into the message.

    Returns T | undefined

    The message that was logged.

    import { critical } from "@std/log/critical";
    import { assertEquals } from "@std/assert/equals";

    assertEquals(critical("This is a critical message."), "This is a critical message.");
    // Prints: "CRITICAL This is a critical message."

    assertEquals(critical(() => "This is a critical message."), "This is a critical message.");
    // Prints: "CRITICAL This is a critical message."
  • Log at the critical level.

    This function is a pass-through to the default logger's critical method. By default, the default logger is configured to use console.log and print in bold red text.

    Type Parameters

    • T

      The type of the message to log.

    Parameters

    • msg: T extends GenericFunction
          ? never
          : T

      The message to log.

    • Rest...args: unknown[]

      Arguments to be formatted into the message.

    Returns T

    The message that was logged.

    import { critical } from "@std/log/critical";
    import { assertEquals } from "@std/assert/equals";

    assertEquals(critical("This is a critical message."), "This is a critical message.");
    // Prints: "CRITICAL This is a critical message."

    assertEquals(critical(() => "This is a critical message."), "This is a critical message.");
    // Prints: "CRITICAL This is a critical message."