Skip to main content
Home

Built and signed on GitHub Actions

File sink and rotating file sink for LogTape

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
4 days ago (1.0.4)
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. If nonBlocking is enabled, returns a sink that also implements AsyncDisposable.

getRotatingFileSink(
path: string,
options: RotatingFileSinkOptions & { nonBlocking: true; },
): Sink & AsyncDisposable

Parameters

path: string
options: RotatingFileSinkOptions & { nonBlocking: true; }

Return Type

Sink & AsyncDisposable

New Ticket: 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:@logtape/file

Import symbol

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

Import directly with a jsr specifier

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

Add Package

pnpm i jsr:@logtape/file
or (using pnpm 10.8 or older)
pnpm dlx jsr add @logtape/file

Import symbol

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

Add Package

yarn add jsr:@logtape/file
or (using Yarn 4.8 or older)
yarn dlx jsr add @logtape/file

Import symbol

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

Add Package

vlt install jsr:@logtape/file

Import symbol

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

Add Package

npx jsr add @logtape/file

Import symbol

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

Add Package

bunx jsr add @logtape/file

Import symbol

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