Function error
- error<T>(msg, ...args): T | undefined
Type Parameters
Parameters
Returns T | undefined
The message that was logged.
Example: Usage
import { error } from "@std/log/error";
import { assertEquals } from "@std/assert/equals";
assertEquals(error("This is an error message."), "This is an error message.");
// Prints: "ERROR This is an error message."
assertEquals(error(() => "This is an error message."), "This is an error message.");
// Prints: "ERROR This is an error message."- error<T>(msg, ...args): T
Log at the error level.
This function is a pass-through to the default logger's
errormethod. By default, the default logger is configured to use console.log and print in red text.Type Parameters
Parameters
- msg: T extends GenericFunction
? never
: TThe message to log.
Rest...args: unknown[]Arguments to be formatted into the message.
Returns T
The message that was logged.
Example: Usage
import { error } from "@std/log/error";
import { assertEquals } from "@std/assert/equals";
assertEquals(error("This is an error message."), "This is an error message.");
// Prints: "ERROR This is an error message."
assertEquals(error(() => "This is an error message."), "This is an error message.");
// Prints: "ERROR This is an error message."- msg: T extends GenericFunction
Log at the error level.
This function is a pass-through to the default logger's
errormethod. By default, the default logger is configured to use console.log and print in red text.