@logtape/logtape 0.2.0-dev.21 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -23,7 +23,7 @@ sinks.](#sinks)
23
23
  ![](./screenshots/terminal-console.png)
24
24
 
25
25
  [JSR]: https://jsr.io/@logtape/logtape
26
- [JSR badge]: https://jsr.io/badges/@logtape/logtape
26
+ [JSR badge]: https://jsr.io/badges/@logtape/logtape?v=0.2.0
27
27
  [npm]: https://www.npmjs.com/package/@logtape/logtape
28
28
  [npm badge]: https://img.shields.io/npm/v/@logtape/logtape?logo=npm
29
29
  [GitHub Actions]: https://github.com/dahlia/logtape/actions/workflows/main.yaml
@@ -271,6 +271,37 @@ in the API reference for more details.
271
271
  [`getFileSink()`]: https://jsr.io/@logtape/logtape/doc/~/getFileSink
272
272
  [`FileSinkOptions`]: https://jsr.io/@logtape/logtape/doc/~/FileSinkOptions
273
273
 
274
+ ### Rotating file sink
275
+
276
+ > [!NOTE]
277
+ > File sink is unavailable in the browser environment.
278
+
279
+ A rotating file sink is a file sink that rotates log files. It creates a new
280
+ log file when the current log file reaches a certain size. Here's an example
281
+ of a rotating file sink that writes log messages to a file:
282
+
283
+ ~~~~ typescript
284
+ import { getRotatingFileSink } from "@logtape/logtape";
285
+
286
+ await configure({
287
+ sinks: {
288
+ file: getRotatingFileSink("my-app.log", {
289
+ maxFileSize: 1024 * 1024, // 1 MiB
290
+ maxFiles: 5,
291
+ }),
292
+ },
293
+ // Omitted for brevity
294
+ });
295
+ ~~~~
296
+
297
+ Rotated log files are named with a suffix like *.1*, *.2*, *.3*, and so on.
298
+
299
+ For more details, see [`getRotatingFileSink()`] function and
300
+ [`RotatingFileSinkOptions`] interface in the API reference.
301
+
302
+ [`getRotatingFileSink()`]: https://jsr.io/@logtape/logtape/doc/~/getRotatingFileSink
303
+ [`RotatingFileSinkOptions`]: https://jsr.io/@logtape/logtape/doc/~/RotatingFileSinkOptions
304
+
274
305
  ### Text formatter
275
306
 
276
307
  A stream sink and a file sink write log messages in a plain text format.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logtape/logtape",
3
- "version": "0.2.0-dev.21+f0e45b0e",
3
+ "version": "0.2.0",
4
4
  "description": "Simple logging library with zero dependencies for Deno/Node.js/Bun/browsers",
5
5
  "keywords": [
6
6
  "logging",