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
3 weeks ago (0.8.0)
function getRotatingFileSink
getRotatingFileSink(): Sink & Disposable

Get a rotating file sink.

This sink writes log records to a file, and rotates the file when it reaches the maxSize. The rotated files are named with the original file name followed by a dot and a number, starting from 1. The number is incremented for each rotation, and the maximum number of files to keep is maxFiles.

Note that this function is unavailable in the browser.

Parameters

path: string

A path to the file to write to.

optional
options: RotatingFileSinkOptions

The options for the sink and the file driver.

Return Type

Sink & Disposable

A sink that writes to the file. The sink is also a disposable object that closes the file when disposed.

Add Package

deno add jsr:@logtape/logtape

Import symbol

import { getRotatingFileSink } from "@logtape/logtape";

---- OR ----

Import directly with a jsr specifier

import { getRotatingFileSink } from "jsr:@logtape/logtape";

Add Package

npx jsr add @logtape/logtape

Import symbol

import { getRotatingFileSink } from "@logtape/logtape";

Add Package

yarn dlx jsr add @logtape/logtape

Import symbol

import { getRotatingFileSink } from "@logtape/logtape";

Add Package

pnpm dlx jsr add @logtape/logtape

Import symbol

import { getRotatingFileSink } from "@logtape/logtape";

Add Package

bunx jsr add @logtape/logtape

Import symbol

import { getRotatingFileSink } from "@logtape/logtape";