The ANSI colors. These can be used to colorize text in the console.
A text formatter that uses ANSI colors to format log records.
The various options for the ANSI color formatter.
The ANSI text styles.
Compares two log levels.
A configuration error.
Configure the loggers with the specified configuration.
Configure sync loggers with the specified configuration.
A console formatter is a function that accepts a log record and returns an array of arguments to pass to console.log.
A generic interface for a context-local storage. It resembles the AsyncLocalStorage API from Node.js.
The default console formatter.
The default text formatter. This formatter formats log records as follows:
Dispose of the disposables.
Dispose of the sync disposables. Async disposables will be untouched, use dispose if you have async sinks.
A filter is a function that accepts a log record and returns true
if the
record should be passed to the sink.
A filter-like value is either a Filter or a LogLevel.
null
is also allowed to represent a filter that rejects all records.
Get an ANSI color formatter with the specified options.
Get the current configuration, if any. Otherwise, null
.
A console sink factory that returns a sink that logs to the console.
Returns a filter that accepts log records with the specified level.
Get a logger with the given category.
A factory that returns a sink that writes to a WritableStream.
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.
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.
The severity level of a LogRecord.
Parses a log level from a string.
Reset the configuration. Mostly for testing purposes.
Reset the configuration. Mostly for testing purposes. Will not clear async sinks, only use with sync sinks. Use reset if you have async sinks.
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.)
A text formatter is a function that accepts a log record and returns a string.
Converts a FilterLike value to an actual Filter.
Runs a callback with the given implicit context. Every single log record in the callback will have the given context.
Turns a sink into a filtered sink. The returned sink only logs records that pass the filter.