Skip to main content

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
5 days ago (0.4.2)
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.

f
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.

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.

v
getFileSink
No documentation available
f
getLevelFilter

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

f
getLogger

Get a logger with the given category.

v
getRotatingFileSink
No documentation available
f
getStreamSink

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

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.

I
LoggerConfig

A logger configuration.

T
LogLevel

The severity level of a LogRecord.

I
LogRecord

A log record.

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.

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.