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

Classes

c
Logger(
loggerName: string,
levelName: LevelName,
options?: LoggerOptions
)

A logger that can log messages at different levels.

  • critical<T>(
    msg: () => T,
    ...args: unknown[]
    ): T | undefined

    Log at the critical level.

  • debug<T>(
    msg: () => T,
    ...args: unknown[]
    ): T | undefined

    Log at the debug level.

  • error<T>(
    msg: () => T,
    ...args: unknown[]
    ): T | undefined

    Log at the error level.

  • handlers: BaseHandler[]

    The handlers to use for the logger.

  • info<T>(
    msg: () => T,
    ...args: unknown[]
    ): T | undefined

    Log at the info level.

  • level(): LogLevel

    Getter for the log level.

  • levelName(): LevelName

    Getter for the name of the log level.

  • loggerName(): string

    Getter for the name of the logger.

  • warn<T>(
    msg: () => T,
    ...args: unknown[]
    ): T | undefined

    Log at the warning level.

c

Configuration options for a logger instance.

  • handlers: string[]

    A list of handler names attached to this logger.

  • level: LevelName

    The minimum log level for the logger.

c
LogRecord(options: LogRecordOptions)

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

  • args(): unknown[]

    Getter for the arguments to log.

  • datetime(): Date

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

  • level: number

    The numeric log level of the log record.

  • levelName: string

    The name of the log level of the log record.

  • loggerName: string

    The name of the logger that created the log record.

  • msg: string

    The message to log.

Interfaces

I

Configuration for logger setup.

  • handlers: { [name: string]: BaseHandler; }

    A dictionary of named handlers for logging.

  • loggers: { [name: string]: LoggerConfig; }

    A dictionary of named loggers and their configurations.

I

Options for Logger.

  • handlers: BaseHandler[]

    The handlers to use for the logger.

  • args: unknown[]

    The arguments to log.

  • level: LogLevel

    The log level of the message.

  • loggerName: string

    The name of the logger that created the log record.

  • msg: string

    The message to log.

Type Aliases

T
GenericFunction = (...args: any[]) => any

Any function that can be called with any arguments and return any value.

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 * as mod from "@std/log/logger";
or

Import directly with a jsr specifier

import * as mod from "jsr:@std/log@^0.224.14/logger";