Skip to main content
This release is 5 versions behind 0.8.0 — the latest version of @logtape/logtape. Jump to latest

Built and signed on GitHub Actions

Simple logging library with zero dependencies for Deno/Node.js/Bun/browsers

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 months ago (0.6.2)
T
AnsiColor

The ANSI colors. These can be used to colorize text in the console.

v
ansiColorFormatter

A text formatter that uses ANSI colors to format log records.

T
AnsiStyle

The ANSI text styles.

I
Config

A configuration for the loggers.

c
ConfigError

A configuration error.

f
configure

Configure the loggers with the specified configuration.

T
ConsoleFormatter

A console formatter is a function that accepts a log record and returns an array of arguments to pass to console.log.

I
ConsoleSinkOptions

Options for the getConsoleSink function.

f
defaultConsoleFormatter

The default console formatter.

v
defaultTextFormatter

The default text formatter. This formatter formats log records as follows:

f
dispose

Dispose of the disposables.

T
FileSinkOptions

Options for the getFileSink function.

T
Filter

A filter is a function that accepts a log record and returns true if the record should be passed to the sink.

T
FilterLike

A filter-like value is either a Filter or a LogLevel. null is also allowed to represent a filter that rejects all records.

I
FormattedValues

The formatted values for a log record.

f
getAnsiColorFormatter

Get an ANSI color formatter with the specified options.

f
getConfig

Get the current configuration, if any. Otherwise, null.

f
getConsoleSink

A console sink factory that returns a sink that logs to the console.

f
getFileSink

Get a file sink.

f
getLevelFilter

Returns a filter that accepts log records with the specified level.

f
getLogger

Get a logger with the given category.

f
getRotatingFileSink

Get a rotating file sink.

f
getStreamSink

A factory that returns a sink that writes to a WritableStream.

f
getTextFormatter

Get a text formatter with the specified options. Although it's flexible enough to create a custom formatter, if you want more control, you can create a custom formatter that satisfies the TextFormatter type instead.

f
isLogLevel

Checks if a string is a valid log level. This function can be used as as a type guard to narrow the type of a string to a LogLevel.

I
Logger

A logger interface. It provides methods to log messages at different severity levels.

T
LogLevel

The severity level of a LogRecord.

f
parseLogLevel

Parses a log level from a string.

f
reset

Reset the configuration. Mostly for testing purposes.

I
RotatingFileSinkOptions

Options for the getRotatingFileSink function.

T
Sink

A sink is a function that accepts a log record and prints it somewhere. Thrown exceptions will be suppressed and then logged to the meta logger, a Logger with the category ["logtape", "meta"]. (In that case, the meta log record will not be passed to the sink to avoid infinite recursion.)

I
StreamSinkOptions

Options for the getStreamSink function.

T
TextFormatter

A text formatter is a function that accepts a log record and returns a string.

I
TextFormatterOptions

The various options for the built-in text formatters.

f
toFilter

Converts a FilterLike value to an actual Filter.

f
withFilter

Turns a sink into a filtered sink. The returned sink only logs records that pass the filter.