Skip to main content

@std/log@0.224.14
Built and signed on GitHub Actions

Works with
This package works with DenoIt is unknown whether this package works with Bun
This package works with Deno
It is unknown whether this package works with Bun
•JSR Score88%•
Downloads13,180/wk
•
Published2 years ago (0.224.14)

UNSTABLE: A customizable logger framework

class LogRecord

An object that encapsulates provided message and arguments as well some metadata that can be later used when formatting a message.

Examples

Usage

import { LogRecord } from "@std/log/logger";
import { LogLevels } from "@std/log/levels";
import { assertEquals } from "@std/assert/equals";

const record = new LogRecord({
  msg: "Hello, world!",
  args: ["foo", "bar"],
  level: LogLevels.INFO,
  loggerName: "example",
});

assertEquals(record.msg, "Hello, world!");
assertEquals(record.args, ["foo", "bar"]);
assertEquals(record.level, LogLevels.INFO);
assertEquals(record.loggerName, "example");

Constructors

new LogRecord(options: LogRecordOptions)

Constructs a new instance.

Parameters

The options to create a new log record.

Usage

import { LogRecord } from "@std/log/logger";
import { LogLevels } from "@std/log/levels";

const record = new LogRecord({
  msg: "Hello, world!",
  args: ["foo", "bar"],
  level: LogLevels.INFO,
  loggerName: "example",
});

Properties

readonly
args: unknown[]

Getter for the arguments to log.

Getter for the date and time the log record was created.

The numeric log level of the log record.

The name of the log level of the log record.

The name of the logger that created the log record.

The message to log.

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:@std/log

Import symbol

import { LogRecord } from "@std/log/logger";
or

Import directly with a jsr specifier

import { LogRecord } from "jsr:@std/log@^0.224.14/logger";