@logtape/file 1.4.0-dev.468 → 2.0.0-dev.470

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.
@@ -46,7 +46,7 @@ const denoAsyncDriver = {
46
46
  };
47
47
  /**
48
48
  * A Deno-specific time-rotating file sink driver.
49
- * @since 1.4.0
49
+ * @since 2.0.0
50
50
  */
51
51
  const denoTimeDriver = {
52
52
  ...denoDriver,
@@ -61,7 +61,7 @@ const denoTimeDriver = {
61
61
  };
62
62
  /**
63
63
  * A Deno-specific async time-rotating file sink driver.
64
- * @since 1.4.0
64
+ * @since 2.0.0
65
65
  */
66
66
  const denoAsyncTimeDriver = {
67
67
  ...denoAsyncDriver,
@@ -15,12 +15,12 @@ declare const denoDriver: RotatingFileSinkDriver<Deno.FsFile>;
15
15
  declare const denoAsyncDriver: AsyncRotatingFileSinkDriver<Deno.FsFile>;
16
16
  /**
17
17
  * A Deno-specific time-rotating file sink driver.
18
- * @since 1.4.0
18
+ * @since 2.0.0
19
19
  */
20
20
  declare const denoTimeDriver: TimeRotatingFileSinkDriver<Deno.FsFile>;
21
21
  /**
22
22
  * A Deno-specific async time-rotating file sink driver.
23
- * @since 1.4.0
23
+ * @since 2.0.0
24
24
  */
25
25
  declare const denoAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<Deno.FsFile>;
26
26
  /**
@@ -71,7 +71,7 @@ declare function getRotatingFileSink(path: string, options: RotatingFileSinkOpti
71
71
  * @returns A sink that writes to the file. The sink is also a disposable
72
72
  * object that closes the file when disposed. If `nonBlocking` is
73
73
  * enabled, returns a sink that also implements {@link AsyncDisposable}.
74
- * @since 1.4.0
74
+ * @since 2.0.0
75
75
  */
76
76
  declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions): Sink & Disposable;
77
77
  declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions & {
@@ -15,12 +15,12 @@ declare const denoDriver: RotatingFileSinkDriver<Deno.FsFile>;
15
15
  declare const denoAsyncDriver: AsyncRotatingFileSinkDriver<Deno.FsFile>;
16
16
  /**
17
17
  * A Deno-specific time-rotating file sink driver.
18
- * @since 1.4.0
18
+ * @since 2.0.0
19
19
  */
20
20
  declare const denoTimeDriver: TimeRotatingFileSinkDriver<Deno.FsFile>;
21
21
  /**
22
22
  * A Deno-specific async time-rotating file sink driver.
23
- * @since 1.4.0
23
+ * @since 2.0.0
24
24
  */
25
25
  declare const denoAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<Deno.FsFile>;
26
26
  /**
@@ -71,7 +71,7 @@ declare function getRotatingFileSink(path: string, options: RotatingFileSinkOpti
71
71
  * @returns A sink that writes to the file. The sink is also a disposable
72
72
  * object that closes the file when disposed. If `nonBlocking` is
73
73
  * enabled, returns a sink that also implements {@link AsyncDisposable}.
74
- * @since 1.4.0
74
+ * @since 2.0.0
75
75
  */
76
76
  declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions): Sink & Disposable;
77
77
  declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions & {
@@ -46,7 +46,7 @@ const denoAsyncDriver = {
46
46
  };
47
47
  /**
48
48
  * A Deno-specific time-rotating file sink driver.
49
- * @since 1.4.0
49
+ * @since 2.0.0
50
50
  */
51
51
  const denoTimeDriver = {
52
52
  ...denoDriver,
@@ -61,7 +61,7 @@ const denoTimeDriver = {
61
61
  };
62
62
  /**
63
63
  * A Deno-specific async time-rotating file sink driver.
64
- * @since 1.4.0
64
+ * @since 2.0.0
65
65
  */
66
66
  const denoAsyncTimeDriver = {
67
67
  ...denoAsyncDriver,
@@ -1 +1 @@
1
- {"version":3,"file":"filesink.deno.js","names":["denoDriver: RotatingFileSinkDriver<Deno.FsFile>","path: string","fd: Deno.FsFile","chunks: Uint8Array[]","denoAsyncDriver: AsyncRotatingFileSinkDriver<Deno.FsFile>","denoTimeDriver: TimeRotatingFileSinkDriver<Deno.FsFile>","options?: { recursive?: boolean }","denoAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<Deno.FsFile>","options: FileSinkOptions","options: RotatingFileSinkOptions","options: TimeRotatingFileSinkOptions"],"sources":["../src/filesink.deno.ts"],"sourcesContent":["import type { Sink } from \"@logtape/logtape\";\nimport { join } from \"@std/path/join\";\nimport {\n type AsyncRotatingFileSinkDriver,\n type FileSinkOptions,\n getBaseFileSink,\n getBaseRotatingFileSink,\n type RotatingFileSinkDriver,\n type RotatingFileSinkOptions,\n} from \"./filesink.base.ts\";\nimport {\n type AsyncTimeRotatingFileSinkDriver,\n getBaseTimeRotatingFileSink,\n type TimeRotatingFileSinkDriver,\n type TimeRotatingFileSinkOptions,\n} from \"./timefilesink.ts\";\n\n/**\n * A Deno-specific file sink driver.\n */\nexport const denoDriver: RotatingFileSinkDriver<Deno.FsFile> = {\n openSync(path: string) {\n return Deno.openSync(path, { create: true, append: true });\n },\n writeSync(fd, chunk) {\n fd.writeSync(chunk);\n },\n writeManySync(fd: Deno.FsFile, chunks: Uint8Array[]): void {\n // Deno doesn't have writev, but we can optimize by writing all chunks\n // then doing a single sync operation\n for (const chunk of chunks) {\n fd.writeSync(chunk);\n }\n },\n flushSync(fd) {\n fd.syncSync();\n },\n closeSync(fd) {\n fd.close();\n },\n statSync: globalThis?.Deno.statSync,\n renameSync: globalThis?.Deno.renameSync,\n};\n\n/**\n * A Deno-specific async file sink driver.\n * @since 1.0.0\n */\nexport const denoAsyncDriver: AsyncRotatingFileSinkDriver<Deno.FsFile> = {\n ...denoDriver,\n async writeMany(fd: Deno.FsFile, chunks: Uint8Array[]): Promise<void> {\n // Deno doesn't have async writev, but we can write all chunks\n // then do a single async sync\n for (const chunk of chunks) {\n await fd.write(chunk);\n }\n },\n async flush(fd) {\n await fd.sync();\n },\n close(fd) {\n return Promise.resolve(fd.close());\n },\n};\n\n/**\n * A Deno-specific time-rotating file sink driver.\n * @since 1.4.0\n */\nexport const denoTimeDriver: TimeRotatingFileSinkDriver<Deno.FsFile> = {\n ...denoDriver,\n readdirSync(path: string) {\n return [...Deno.readDirSync(path)].map((entry) => entry.name);\n },\n unlinkSync: globalThis?.Deno.removeSync,\n mkdirSync(path: string, options?: { recursive?: boolean }) {\n Deno.mkdirSync(path, options);\n },\n joinPath: join,\n};\n\n/**\n * A Deno-specific async time-rotating file sink driver.\n * @since 1.4.0\n */\nexport const denoAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<Deno.FsFile> =\n {\n ...denoAsyncDriver,\n readdirSync(path: string) {\n return [...Deno.readDirSync(path)].map((entry) => entry.name);\n },\n unlinkSync: globalThis?.Deno.removeSync,\n mkdirSync(path: string, options?: { recursive?: boolean }) {\n Deno.mkdirSync(path, options);\n },\n joinPath: join,\n };\n\n/**\n * Get a file sink.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param path A path to the file to write to.\n * @param options The options for the sink.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is enabled,\n * returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getFileSink(\n path: string,\n options?: FileSinkOptions,\n): Sink & Disposable;\nexport function getFileSink(\n path: string,\n options: FileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getFileSink(\n path: string,\n options: FileSinkOptions = {},\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseFileSink(path, { ...options, ...denoAsyncDriver });\n }\n return getBaseFileSink(path, { ...options, ...denoDriver });\n}\n\n/**\n * Get a rotating file sink.\n *\n * This sink writes log records to a file, and rotates the file when it reaches\n * the `maxSize`. The rotated files are named with the original file name\n * followed by a dot and a number, starting from 1. The number is incremented\n * for each rotation, and the maximum number of files to keep is `maxFiles`.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param path A path to the file to write to.\n * @param options The options for the sink and the file driver.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is enabled,\n * returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getRotatingFileSink(\n path: string,\n options?: RotatingFileSinkOptions,\n): Sink & Disposable;\nexport function getRotatingFileSink(\n path: string,\n options: RotatingFileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getRotatingFileSink(\n path: string,\n options: RotatingFileSinkOptions = {},\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseRotatingFileSink(path, { ...options, ...denoAsyncDriver });\n }\n return getBaseRotatingFileSink(path, { ...options, ...denoDriver });\n}\n\n/**\n * Get a time-rotating file sink.\n *\n * This sink writes log records to a file in a directory, rotating to a new\n * file based on time intervals. The filename is generated based on the\n * current date/time and the configured interval.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param options The options for the sink.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is\n * enabled, returns a sink that also implements {@link AsyncDisposable}.\n * @since 1.4.0\n */\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions,\n): Sink & Disposable;\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions,\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseTimeRotatingFileSink({ ...options, ...denoAsyncTimeDriver });\n }\n return getBaseTimeRotatingFileSink({ ...options, ...denoTimeDriver });\n}\n\n// cSpell: ignore filesink\n"],"mappings":";;;;;;;;AAoBA,MAAaA,aAAkD;CAC7D,SAASC,MAAc;AACrB,SAAO,KAAK,SAAS,MAAM;GAAE,QAAQ;GAAM,QAAQ;EAAM,EAAC;CAC3D;CACD,UAAU,IAAI,OAAO;AACnB,KAAG,UAAU,MAAM;CACpB;CACD,cAAcC,IAAiBC,QAA4B;AAGzD,OAAK,MAAM,SAAS,OAClB,IAAG,UAAU,MAAM;CAEtB;CACD,UAAU,IAAI;AACZ,KAAG,UAAU;CACd;CACD,UAAU,IAAI;AACZ,KAAG,OAAO;CACX;C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SACuC;AACvC,KAAI,QAAQ,YACV,QAAO,4BAA4B;EAAE,GAAG;EAAS,GAAG;CAAqB,EAAC;AAE5E,QAAO,4BAA4B;EAAE,GAAG;EAAS,GAAG;CAAgB,EAAC;AACtE"}
1
+ {"version":3,"file":"filesink.deno.js","names":["denoDriver: RotatingFileSinkDriver<Deno.FsFile>","path: string","fd: Deno.FsFile","chunks: Uint8Array[]","denoAsyncDriver: AsyncRotatingFileSinkDriver<Deno.FsFile>","denoTimeDriver: TimeRotatingFileSinkDriver<Deno.FsFile>","options?: { recursive?: boolean }","denoAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<Deno.FsFile>","options: FileSinkOptions","options: RotatingFileSinkOptions","options: TimeRotatingFileSinkOptions"],"sources":["../src/filesink.deno.ts"],"sourcesContent":["import type { Sink } from \"@logtape/logtape\";\nimport { join } from \"@std/path/join\";\nimport {\n type AsyncRotatingFileSinkDriver,\n type FileSinkOptions,\n getBaseFileSink,\n getBaseRotatingFileSink,\n type RotatingFileSinkDriver,\n type RotatingFileSinkOptions,\n} from \"./filesink.base.ts\";\nimport {\n type AsyncTimeRotatingFileSinkDriver,\n getBaseTimeRotatingFileSink,\n type TimeRotatingFileSinkDriver,\n type TimeRotatingFileSinkOptions,\n} from \"./timefilesink.ts\";\n\n/**\n * A Deno-specific file sink driver.\n */\nexport const denoDriver: RotatingFileSinkDriver<Deno.FsFile> = {\n openSync(path: string) {\n return Deno.openSync(path, { create: true, append: true });\n },\n writeSync(fd, chunk) {\n fd.writeSync(chunk);\n },\n writeManySync(fd: Deno.FsFile, chunks: Uint8Array[]): void {\n // Deno doesn't have writev, but we can optimize by writing all chunks\n // then doing a single sync operation\n for (const chunk of chunks) {\n fd.writeSync(chunk);\n }\n },\n flushSync(fd) {\n fd.syncSync();\n },\n closeSync(fd) {\n fd.close();\n },\n statSync: globalThis?.Deno.statSync,\n renameSync: globalThis?.Deno.renameSync,\n};\n\n/**\n * A Deno-specific async file sink driver.\n * @since 1.0.0\n */\nexport const denoAsyncDriver: AsyncRotatingFileSinkDriver<Deno.FsFile> = {\n ...denoDriver,\n async writeMany(fd: Deno.FsFile, chunks: Uint8Array[]): Promise<void> {\n // Deno doesn't have async writev, but we can write all chunks\n // then do a single async sync\n for (const chunk of chunks) {\n await fd.write(chunk);\n }\n },\n async flush(fd) {\n await fd.sync();\n },\n close(fd) {\n return Promise.resolve(fd.close());\n },\n};\n\n/**\n * A Deno-specific time-rotating file sink driver.\n * @since 2.0.0\n */\nexport const denoTimeDriver: TimeRotatingFileSinkDriver<Deno.FsFile> = {\n ...denoDriver,\n readdirSync(path: string) {\n return [...Deno.readDirSync(path)].map((entry) => entry.name);\n },\n unlinkSync: globalThis?.Deno.removeSync,\n mkdirSync(path: string, options?: { recursive?: boolean }) {\n Deno.mkdirSync(path, options);\n },\n joinPath: join,\n};\n\n/**\n * A Deno-specific async time-rotating file sink driver.\n * @since 2.0.0\n */\nexport const denoAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<Deno.FsFile> =\n {\n ...denoAsyncDriver,\n readdirSync(path: string) {\n return [...Deno.readDirSync(path)].map((entry) => entry.name);\n },\n unlinkSync: globalThis?.Deno.removeSync,\n mkdirSync(path: string, options?: { recursive?: boolean }) {\n Deno.mkdirSync(path, options);\n },\n joinPath: join,\n };\n\n/**\n * Get a file sink.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param path A path to the file to write to.\n * @param options The options for the sink.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is enabled,\n * returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getFileSink(\n path: string,\n options?: FileSinkOptions,\n): Sink & Disposable;\nexport function getFileSink(\n path: string,\n options: FileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getFileSink(\n path: string,\n options: FileSinkOptions = {},\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseFileSink(path, { ...options, ...denoAsyncDriver });\n }\n return getBaseFileSink(path, { ...options, ...denoDriver });\n}\n\n/**\n * Get a rotating file sink.\n *\n * This sink writes log records to a file, and rotates the file when it reaches\n * the `maxSize`. The rotated files are named with the original file name\n * followed by a dot and a number, starting from 1. The number is incremented\n * for each rotation, and the maximum number of files to keep is `maxFiles`.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param path A path to the file to write to.\n * @param options The options for the sink and the file driver.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is enabled,\n * returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getRotatingFileSink(\n path: string,\n options?: RotatingFileSinkOptions,\n): Sink & Disposable;\nexport function getRotatingFileSink(\n path: string,\n options: RotatingFileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getRotatingFileSink(\n path: string,\n options: RotatingFileSinkOptions = {},\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseRotatingFileSink(path, { ...options, ...denoAsyncDriver });\n }\n return getBaseRotatingFileSink(path, { ...options, ...denoDriver });\n}\n\n/**\n * Get a time-rotating file sink.\n *\n * This sink writes log records to a file in a directory, rotating to a new\n * file based on time intervals. The filename is generated based on the\n * current date/time and the configured interval.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param options The options for the sink.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is\n * enabled, returns a sink that also implements {@link AsyncDisposable}.\n * @since 2.0.0\n */\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions,\n): Sink & Disposable;\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions,\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseTimeRotatingFileSink({ ...options, ...denoAsyncTimeDriver });\n }\n return getBaseTimeRotatingFileSink({ ...options, ...denoTimeD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AAE,GACU;AACvC,KAAI,QAAQ,YACV,QAAO,gBAAgB,MAAM;EAAE,GAAG;EAAS,GAAG;CAAiB,EAAC;AAElE,QAAO,gBAAgB,MAAM;EAAE,GAAG;EAAS,GAAG;CAAY,EAAC;AAC5D;AA0BD,SAAgB,oBACdP,MACAQ,UAAmC,CAAE,GACE;AACvC,KAAI,QAAQ,YACV,QAAO,wBAAwB,MAAM;EAAE,GAAG;EAAS,GAAG;CAAiB,EAAC;AAE1E,QAAO,wBAAwB,MAAM;EAAE,GAAG;EAAS,GAAG;CAAY,EAAC;AACpE;AAuBD,SAAgB,wBACdC,SACuC;AACvC,KAAI,QAAQ,YACV,QAAO,4BAA4B;EAAE,GAAG;EAAS,GAAG;CAAqB,EAAC;AAE5E,QAAO,4BAA4B;EAAE,GAAG;EAAS,GAAG;CAAgB,EAAC;AACtE"}
@@ -46,7 +46,7 @@ const nodeAsyncDriver = {
46
46
  };
47
47
  /**
48
48
  * A Node.js-specific time-rotating file sink driver.
49
- * @since 1.4.0
49
+ * @since 2.0.0
50
50
  */
51
51
  const nodeTimeDriver = {
52
52
  ...nodeDriver,
@@ -57,7 +57,7 @@ const nodeTimeDriver = {
57
57
  };
58
58
  /**
59
59
  * A Node.js-specific async time-rotating file sink driver.
60
- * @since 1.4.0
60
+ * @since 2.0.0
61
61
  */
62
62
  const nodeAsyncTimeDriver = {
63
63
  ...nodeAsyncDriver,
@@ -15,12 +15,12 @@ declare const nodeDriver: RotatingFileSinkDriver<number | void>;
15
15
  declare const nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void>;
16
16
  /**
17
17
  * A Node.js-specific time-rotating file sink driver.
18
- * @since 1.4.0
18
+ * @since 2.0.0
19
19
  */
20
20
  declare const nodeTimeDriver: TimeRotatingFileSinkDriver<number | void>;
21
21
  /**
22
22
  * A Node.js-specific async time-rotating file sink driver.
23
- * @since 1.4.0
23
+ * @since 2.0.0
24
24
  */
25
25
  declare const nodeAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<number | void>;
26
26
  /**
@@ -71,7 +71,7 @@ declare function getRotatingFileSink(path: string, options: RotatingFileSinkOpti
71
71
  * @returns A sink that writes to the file. The sink is also a disposable
72
72
  * object that closes the file when disposed. If `nonBlocking` is
73
73
  * enabled, returns a sink that also implements {@link AsyncDisposable}.
74
- * @since 1.4.0
74
+ * @since 2.0.0
75
75
  */
76
76
  declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions): Sink & Disposable;
77
77
  declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions & {
@@ -15,12 +15,12 @@ declare const nodeDriver: RotatingFileSinkDriver<number | void>;
15
15
  declare const nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void>;
16
16
  /**
17
17
  * A Node.js-specific time-rotating file sink driver.
18
- * @since 1.4.0
18
+ * @since 2.0.0
19
19
  */
20
20
  declare const nodeTimeDriver: TimeRotatingFileSinkDriver<number | void>;
21
21
  /**
22
22
  * A Node.js-specific async time-rotating file sink driver.
23
- * @since 1.4.0
23
+ * @since 2.0.0
24
24
  */
25
25
  declare const nodeAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<number | void>;
26
26
  /**
@@ -71,7 +71,7 @@ declare function getRotatingFileSink(path: string, options: RotatingFileSinkOpti
71
71
  * @returns A sink that writes to the file. The sink is also a disposable
72
72
  * object that closes the file when disposed. If `nonBlocking` is
73
73
  * enabled, returns a sink that also implements {@link AsyncDisposable}.
74
- * @since 1.4.0
74
+ * @since 2.0.0
75
75
  */
76
76
  declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions): Sink & Disposable;
77
77
  declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions & {
@@ -45,7 +45,7 @@ const nodeAsyncDriver = {
45
45
  };
46
46
  /**
47
47
  * A Node.js-specific time-rotating file sink driver.
48
- * @since 1.4.0
48
+ * @since 2.0.0
49
49
  */
50
50
  const nodeTimeDriver = {
51
51
  ...nodeDriver,
@@ -56,7 +56,7 @@ const nodeTimeDriver = {
56
56
  };
57
57
  /**
58
58
  * A Node.js-specific async time-rotating file sink driver.
59
- * @since 1.4.0
59
+ * @since 2.0.0
60
60
  */
61
61
  const nodeAsyncTimeDriver = {
62
62
  ...nodeAsyncDriver,
@@ -1 +1 @@
1
- {"version":3,"file":"filesink.node.js","names":["nodeDriver: RotatingFileSinkDriver<number | void>","path: string","fd: number","chunks: Uint8Array[]","nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void>","nodeTimeDriver: TimeRotatingFileSinkDriver<number | void>","nodeAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<\n number | void\n>","options: FileSinkOptions","options: RotatingFileSinkOptions","options: TimeRotatingFileSinkOptions"],"sources":["../src/filesink.node.ts"],"sourcesContent":["import type { Sink } from \"@logtape/logtape\";\nimport fs from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport {\n type AsyncRotatingFileSinkDriver,\n type FileSinkOptions,\n getBaseFileSink,\n getBaseRotatingFileSink,\n type RotatingFileSinkDriver,\n type RotatingFileSinkOptions,\n} from \"./filesink.base.ts\";\nimport {\n type AsyncTimeRotatingFileSinkDriver,\n getBaseTimeRotatingFileSink,\n type TimeRotatingFileSinkDriver,\n type TimeRotatingFileSinkOptions,\n} from \"./timefilesink.ts\";\n\n/**\n * A Node.js-specific file sink driver.\n */\nexport const nodeDriver: RotatingFileSinkDriver<number | void> = {\n openSync(path: string) {\n return fs.openSync(path, \"a\");\n },\n writeSync: fs.writeSync,\n writeManySync(fd: number, chunks: Uint8Array[]): void {\n if (chunks.length === 0) return;\n if (chunks.length === 1) {\n fs.writeSync(fd, chunks[0]);\n return;\n }\n // Use writev for multiple chunks\n fs.writevSync(fd, chunks);\n },\n flushSync: fs.fsyncSync,\n closeSync: fs.closeSync,\n statSync: fs.statSync,\n renameSync: fs.renameSync,\n};\n\n/**\n * A Node.js-specific async file sink driver.\n * @since 1.0.0\n */\nexport const nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void> = {\n ...nodeDriver,\n async writeMany(fd: number, chunks: Uint8Array[]): Promise<void> {\n if (chunks.length === 0) return;\n if (chunks.length === 1) {\n await promisify(fs.write)(fd, chunks[0]);\n return;\n }\n // Use async writev for multiple chunks\n await promisify(fs.writev)(fd, chunks);\n },\n flush: promisify(fs.fsync),\n close: promisify(fs.close),\n};\n\n/**\n * A Node.js-specific time-rotating file sink driver.\n * @since 1.4.0\n */\nexport const nodeTimeDriver: TimeRotatingFileSinkDriver<number | void> = {\n ...nodeDriver,\n readdirSync: fs.readdirSync as (path: string) => string[],\n unlinkSync: fs.unlinkSync,\n mkdirSync: fs.mkdirSync,\n joinPath: join,\n};\n\n/**\n * A Node.js-specific async time-rotating file sink driver.\n * @since 1.4.0\n */\nexport const nodeAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<\n number | void\n> = {\n ...nodeAsyncDriver,\n readdirSync: fs.readdirSync as (path: string) => string[],\n unlinkSync: fs.unlinkSync,\n mkdirSync: fs.mkdirSync,\n joinPath: join,\n};\n\n/**\n * Get a file sink.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param path A path to the file to write to.\n * @param options The options for the sink.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is enabled,\n * returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getFileSink(\n path: string,\n options?: FileSinkOptions,\n): Sink & Disposable;\nexport function getFileSink(\n path: string,\n options: FileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getFileSink(\n path: string,\n options: FileSinkOptions = {},\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseFileSink(path, { ...options, ...nodeAsyncDriver });\n }\n return getBaseFileSink(path, { ...options, ...nodeDriver });\n}\n\n/**\n * Get a rotating file sink.\n *\n * This sink writes log records to a file, and rotates the file when it reaches\n * the `maxSize`. The rotated files are named with the original file name\n * followed by a dot and a number, starting from 1. The number is incremented\n * for each rotation, and the maximum number of files to keep is `maxFiles`.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param path A path to the file to write to.\n * @param options The options for the sink and the file driver.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is enabled,\n * returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getRotatingFileSink(\n path: string,\n options?: RotatingFileSinkOptions,\n): Sink & Disposable;\nexport function getRotatingFileSink(\n path: string,\n options: RotatingFileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getRotatingFileSink(\n path: string,\n options: RotatingFileSinkOptions = {},\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseRotatingFileSink(path, { ...options, ...nodeAsyncDriver });\n }\n return getBaseRotatingFileSink(path, { ...options, ...nodeDriver });\n}\n\n/**\n * Get a time-rotating file sink.\n *\n * This sink writes log records to a file in a directory, rotating to a new\n * file based on time intervals. The filename is generated based on the\n * current date/time and the configured interval.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param options The options for the sink.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is\n * enabled, returns a sink that also implements {@link AsyncDisposable}.\n * @since 1.4.0\n */\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions,\n): Sink & Disposable;\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions,\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseTimeRotatingFileSink({ ...options, ...nodeAsyncTimeDriver });\n }\n return getBaseTimeRotatingFileSink({ ...options, ...nodeTimeDriver });\n}\n\n// cSpell: ignore filesink\n"],"mappings":";;;;;;;;;;AAsBA,MAAaA,aAAoD;CAC/D,SAASC,MAAc;AACrB,SAAO,GAAG,SAAS,MAAM,IAAI;CAC9B;CACD,WAAW,GAAG;CACd,cAAcC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AAS,GAAG;CAAqB,EAAC;AAE5E,QAAO,4BAA4B;EAAE,GAAG;EAAS,GAAG;CAAgB,EAAC;AACtE"}
1
+ {"version":3,"file":"filesink.node.js","names":["nodeDriver: RotatingFileSinkDriver<number | void>","path: string","fd: number","chunks: Uint8Array[]","nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void>","nodeTimeDriver: TimeRotatingFileSinkDriver<number | void>","nodeAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<\n number | void\n>","options: FileSinkOptions","options: RotatingFileSinkOptions","options: TimeRotatingFileSinkOptions"],"sources":["../src/filesink.node.ts"],"sourcesContent":["import type { Sink } from \"@logtape/logtape\";\nimport fs from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport {\n type AsyncRotatingFileSinkDriver,\n type FileSinkOptions,\n getBaseFileSink,\n getBaseRotatingFileSink,\n type RotatingFileSinkDriver,\n type RotatingFileSinkOptions,\n} from \"./filesink.base.ts\";\nimport {\n type AsyncTimeRotatingFileSinkDriver,\n getBaseTimeRotatingFileSink,\n type TimeRotatingFileSinkDriver,\n type TimeRotatingFileSinkOptions,\n} from \"./timefilesink.ts\";\n\n/**\n * A Node.js-specific file sink driver.\n */\nexport const nodeDriver: RotatingFileSinkDriver<number | void> = {\n openSync(path: string) {\n return fs.openSync(path, \"a\");\n },\n writeSync: fs.writeSync,\n writeManySync(fd: number, chunks: Uint8Array[]): void {\n if (chunks.length === 0) return;\n if (chunks.length === 1) {\n fs.writeSync(fd, chunks[0]);\n return;\n }\n // Use writev for multiple chunks\n fs.writevSync(fd, chunks);\n },\n flushSync: fs.fsyncSync,\n closeSync: fs.closeSync,\n statSync: fs.statSync,\n renameSync: fs.renameSync,\n};\n\n/**\n * A Node.js-specific async file sink driver.\n * @since 1.0.0\n */\nexport const nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void> = {\n ...nodeDriver,\n async writeMany(fd: number, chunks: Uint8Array[]): Promise<void> {\n if (chunks.length === 0) return;\n if (chunks.length === 1) {\n await promisify(fs.write)(fd, chunks[0]);\n return;\n }\n // Use async writev for multiple chunks\n await promisify(fs.writev)(fd, chunks);\n },\n flush: promisify(fs.fsync),\n close: promisify(fs.close),\n};\n\n/**\n * A Node.js-specific time-rotating file sink driver.\n * @since 2.0.0\n */\nexport const nodeTimeDriver: TimeRotatingFileSinkDriver<number | void> = {\n ...nodeDriver,\n readdirSync: fs.readdirSync as (path: string) => string[],\n unlinkSync: fs.unlinkSync,\n mkdirSync: fs.mkdirSync,\n joinPath: join,\n};\n\n/**\n * A Node.js-specific async time-rotating file sink driver.\n * @since 2.0.0\n */\nexport const nodeAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<\n number | void\n> = {\n ...nodeAsyncDriver,\n readdirSync: fs.readdirSync as (path: string) => string[],\n unlinkSync: fs.unlinkSync,\n mkdirSync: fs.mkdirSync,\n joinPath: join,\n};\n\n/**\n * Get a file sink.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param path A path to the file to write to.\n * @param options The options for the sink.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is enabled,\n * returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getFileSink(\n path: string,\n options?: FileSinkOptions,\n): Sink & Disposable;\nexport function getFileSink(\n path: string,\n options: FileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getFileSink(\n path: string,\n options: FileSinkOptions = {},\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseFileSink(path, { ...options, ...nodeAsyncDriver });\n }\n return getBaseFileSink(path, { ...options, ...nodeDriver });\n}\n\n/**\n * Get a rotating file sink.\n *\n * This sink writes log records to a file, and rotates the file when it reaches\n * the `maxSize`. The rotated files are named with the original file name\n * followed by a dot and a number, starting from 1. The number is incremented\n * for each rotation, and the maximum number of files to keep is `maxFiles`.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param path A path to the file to write to.\n * @param options The options for the sink and the file driver.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is enabled,\n * returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getRotatingFileSink(\n path: string,\n options?: RotatingFileSinkOptions,\n): Sink & Disposable;\nexport function getRotatingFileSink(\n path: string,\n options: RotatingFileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getRotatingFileSink(\n path: string,\n options: RotatingFileSinkOptions = {},\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseRotatingFileSink(path, { ...options, ...nodeAsyncDriver });\n }\n return getBaseRotatingFileSink(path, { ...options, ...nodeDriver });\n}\n\n/**\n * Get a time-rotating file sink.\n *\n * This sink writes log records to a file in a directory, rotating to a new\n * file based on time intervals. The filename is generated based on the\n * current date/time and the configured interval.\n *\n * Note that this function is unavailable in the browser.\n *\n * @param options The options for the sink.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is\n * enabled, returns a sink that also implements {@link AsyncDisposable}.\n * @since 2.0.0\n */\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions,\n): Sink & Disposable;\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions & { nonBlocking: true },\n): Sink & AsyncDisposable;\nexport function getTimeRotatingFileSink(\n options: TimeRotatingFileSinkOptions,\n): Sink & (Disposable | AsyncDisposable) {\n if (options.nonBlocking) {\n return getBaseTimeRotatingFileSink({ ...options, ...nodeAsyncTimeDriver });\n }\n return getBaseTimeRotatingFileSink({ ...options, ...nodeTimeDriver });\n}\n\n// cSpell: ignore filesink\n"],"mappings":";;;;;;;;;;AAsBA,MAAaA,aAAoD;CAC/D,SAASC,MAAc;AACrB,SAAO,GAAG,SAAS,MAAM,IAAI;CAC9B;CACD,WAAW,GAAG;CACd,cAAcC,IAAYC,QAA4B;AACpD,MAAI,OAAO,WAAW,EAAG;AACzB,MAAI,OAAO,WAAW,GA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AgB,EAAC;AACtE"}
@@ -65,7 +65,7 @@ interface TimeRotatingFileSinkDriver<TFile> extends FileSinkDriver<TFile> {
65
65
  }
66
66
  /**
67
67
  * A platform-specific async time-rotating file sink driver.
68
- * @since 1.4.0
68
+ * @since 2.0.0
69
69
  */
70
70
  interface AsyncTimeRotatingFileSinkDriver<TFile> extends AsyncFileSinkDriver<TFile> {
71
71
  /**
@@ -65,7 +65,7 @@ interface TimeRotatingFileSinkDriver<TFile> extends FileSinkDriver<TFile> {
65
65
  }
66
66
  /**
67
67
  * A platform-specific async time-rotating file sink driver.
68
- * @since 1.4.0
68
+ * @since 2.0.0
69
69
  */
70
70
  interface AsyncTimeRotatingFileSinkDriver<TFile> extends AsyncFileSinkDriver<TFile> {
71
71
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"timefilesink.js","names":["date: Date","interval: TimeRotationInterval","options:\n & TimeRotatingFileSinkOptions\n & (\n | TimeRotatingFileSinkDriver<TFile>\n | AsyncTimeRotatingFileSinkDriver<TFile>\n )","currentFilename: string","currentPath: string","currentRotationKey: string","fd: TFile","lastFlushTimestamp: number","buffer: string","files: string[]","fileDate: Date | null","flushBuffer","sink: Sink & Disposable","record: LogRecord","activeFlush: Promise<void> | null","flushTimer: ReturnType<typeof setInterval> | null","nonBlockingSink: Sink & AsyncDisposable"],"sources":["../src/timefilesink.ts"],"sourcesContent":["import {\n defaultTextFormatter,\n type LogRecord,\n type Sink,\n} from \"@logtape/logtape\";\nimport type {\n AsyncFileSinkDriver,\n FileSinkDriver,\n FileSinkOptions,\n} from \"./filesink.base.ts\";\n\n/**\n * The rotation interval for time-based file sinks.\n */\nexport type TimeRotationInterval = \"hourly\" | \"daily\" | \"weekly\";\n\n/**\n * Options for the {@link getBaseTimeRotatingFileSink} function.\n */\nexport interface TimeRotatingFileSinkOptions\n extends Omit<FileSinkOptions, \"lazy\"> {\n /**\n * The directory to write log files to.\n */\n directory: string;\n\n /**\n * A function that generates the filename for the log file based on the date.\n * Default depends on `interval`:\n * - `\"daily\"`: `YYYY-MM-DD.log` (e.g., `2025-01-15.log`)\n * - `\"hourly\"`: `YYYY-MM-DD-HH.log` (e.g., `2025-01-15-09.log`)\n * - `\"weekly\"`: `YYYY-WW.log` (e.g., `2025-W03.log`)\n */\n filename?: (date: Date) => string;\n\n /**\n * The rotation interval. Defaults to `\"daily\"`.\n */\n interval?: TimeRotationInterval;\n\n /**\n * The maximum age of log files in milliseconds. Files older than this\n * will be deleted. If not specified, old files are not deleted.\n */\n maxAgeMs?: number;\n}\n\n/**\n * A platform-specific time-rotating file sink driver.\n */\nexport interface TimeRotatingFileSinkDriver<TFile>\n extends FileSinkDriver<TFile> {\n /**\n * Read the contents of a directory.\n * @param path A path to the directory.\n * @returns An array of filenames in the directory.\n */\n readdirSync(path: string): string[];\n\n /**\n * Delete a file.\n * @param path A path to the file to delete.\n */\n unlinkSync(path: string): void;\n\n /**\n * Create a directory if it doesn't exist.\n * @param path A path to the directory to create.\n * @param options Options for directory creation.\n */\n mkdirSync(path: string, options?: { recursive?: boolean }): void;\n\n /**\n * Join path segments.\n * @param paths Path segments to join.\n * @returns The joined path.\n */\n joinPath(...paths: string[]): string;\n}\n\n/**\n * A platform-specific async time-rotating file sink driver.\n * @since 1.4.0\n */\nexport interface AsyncTimeRotatingFileSinkDriver<TFile>\n extends AsyncFileSinkDriver<TFile> {\n /**\n * Read the contents of a directory.\n * @param path A path to the directory.\n * @returns An array of filenames in the directory.\n */\n readdirSync(path: string): string[];\n\n /**\n * Delete a file.\n * @param path A path to the file to delete.\n */\n unlinkSync(path: string): void;\n\n /**\n * Create a directory if it doesn't exist.\n * @param path A path to the directory to create.\n * @param options Options for directory creation.\n */\n mkdirSync(path: string, options?: { recursive?: boolean }): void;\n\n /**\n * Join path segments.\n * @param paths Path segments to join.\n * @returns The joined path.\n */\n joinPath(...paths: string[]): string;\n}\n\n/**\n * Get the ISO week number of a date.\n * @param date The date to get the week number of.\n * @returns The ISO week number (1-53).\n */\nexport function getISOWeek(date: Date): number {\n const d = new Date(\n Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()),\n );\n const dayNum = d.getUTCDay() || 7;\n d.setUTCDate(d.getUTCDate() + 4 - dayNum);\n const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));\n return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);\n}\n\n/**\n * Get the ISO week year of a date. This may differ from the calendar year\n * for dates near the start or end of a year.\n * @param date The date to get the ISO week year of.\n * @returns The ISO week year.\n */\nexport function getISOWeekYear(date: Date): number {\n const d = new Date(\n Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()),\n );\n const dayNum = d.getUTCDay() || 7;\n d.setUTCDate(d.getUTCDate() + 4 - dayNum);\n return d.getUTCFullYear();\n}\n\n/**\n * Get the default filename generator for the given interval.\n * @param interval The rotation interval.\n * @returns A function that generates a filename for a given date.\n */\nexport function getDefaultFilename(\n interval: TimeRotationInterval,\n): (date: Date) => string {\n switch (interval) {\n case \"hourly\":\n return (date: Date): string => {\n const yyyy = date.getFullYear();\n const mm = String(date.getMonth() + 1).padStart(2, \"0\");\n const dd = String(date.getDate()).padStart(2, \"0\");\n const hh = String(date.getHours()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd}-${hh}.log`;\n };\n case \"daily\":\n return (date: Date): string => {\n const yyyy = date.getFullYear();\n const mm = String(date.getMonth() + 1).padStart(2, \"0\");\n const dd = String(date.getDate()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd}.log`;\n };\n case \"weekly\":\n return (date: Date): string => {\n const yyyy = getISOWeekYear(date);\n const week = getISOWeek(date);\n return `${yyyy}-W${String(week).padStart(2, \"0\")}.log`;\n };\n }\n}\n\n/**\n * Get the rotation key for the given date and interval.\n * The key is used to determine when to rotate to a new file.\n * @param date The date to get the rotation key of.\n * @param interval The rotation interval.\n * @returns A string key that changes when rotation should occur.\n */\nfunction getRotationKey(date: Date, interval: TimeRotationInterval): string {\n switch (interval) {\n case \"hourly\":\n return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getHours()}`;\n case \"daily\":\n return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;\n case \"weekly\":\n return `${getISOWeekYear(date)}-${getISOWeek(date)}`;\n }\n}\n\n/**\n * Get a platform-independent time-rotating file sink.\n *\n * This sink writes log records to a file in a directory, rotating to a new\n * file based on time intervals. The filename is generated based on the\n * current date/time and the configured interval.\n *\n * @template TFile The type of the file descriptor.\n * @param options The options for the sink and the file driver.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is\n * enabled, returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getBaseTimeRotatingFileSink<TFile>(\n options: TimeRotatingFileSinkOptions & TimeRotatingFileSinkDriver<TFile>,\n): Sink & Disposable;\nexport function getBaseTimeRotatingFileSink<TFile>(\n options: TimeRotatingFileSinkOptions & AsyncTimeRotatingFileSinkDriver<TFile>,\n): Sink & AsyncDisposable;\nexport function getBaseTimeRotatingFileSink<TFile>(\n options:\n & TimeRotatingFileSinkOptions\n & (\n | TimeRotatingFileSinkDriver<TFile>\n | AsyncTimeRotatingFileSinkDriver<TFile>\n ),\n): Sink & (Disposable | AsyncDisposable) {\n const formatter = options.formatter ?? defaultTextFormatter;\n const encoder = options.encoder ?? new TextEncoder();\n const interval = options.interval ?? \"daily\";\n const filenameGenerator = options.filename ?? getDefaultFilename(interval);\n const maxAgeMs = options.maxAgeMs;\n const bufferSize = options.bufferSize ?? 1024 * 8;\n const flushInterval = options.flushInterval ?? 5000;\n const directory = options.directory;\n\n // Ensure directory exists\n try {\n options.mkdirSync(directory, { recursive: true });\n } catch {\n // Directory might already exist\n }\n\n let currentFilename: string = filenameGenerator(new Date());\n let currentPath: string = options.joinPath(directory, currentFilename);\n let currentRotationKey: string = getRotationKey(new Date(), interval);\n let fd: TFile = options.openSync(currentPath);\n let lastFlushTimestamp: number = Date.now();\n let buffer: string = \"\";\n\n function shouldRotate(): boolean {\n const now = new Date();\n const newKey = getRotationKey(now, interval);\n return newKey !== currentRotationKey;\n }\n\n function performRotation(): void {\n options.closeSync(fd);\n const now = new Date();\n currentFilename = filenameGenerator(now);\n currentPath = options.joinPath(directory, currentFilename);\n currentRotationKey = getRotationKey(now, interval);\n fd = options.openSync(currentPath);\n }\n\n function cleanupOldFiles(): void {\n if (maxAgeMs === undefined) return;\n\n const now = Date.now();\n let files: string[];\n try {\n files = options.readdirSync(directory);\n } catch {\n return;\n }\n\n for (const file of files) {\n if (!file.endsWith(\".log\")) continue;\n if (file === currentFilename) continue;\n\n const filePath = options.joinPath(directory, file);\n\n // Try to parse the date from the filename\n const dateMatch = file.match(\n /^(\\d{4})-(\\d{2})-(\\d{2})(?:-(\\d{2}))?\\.log$/,\n );\n const weekMatch = file.match(/^(\\d{4})-W(\\d{2})\\.log$/);\n\n let fileDate: Date | null = null;\n\n if (dateMatch) {\n const [, year, month, day, hour] = dateMatch;\n fileDate = new Date(\n parseInt(year!, 10),\n parseInt(month!, 10) - 1,\n parseInt(day!, 10),\n hour ? parseInt(hour, 10) : 0,\n );\n } else if (weekMatch) {\n const [, year, week] = weekMatch;\n // Get the date of the first day of the week\n const jan4 = new Date(parseInt(year!, 10), 0, 4);\n const dayOfWeek = jan4.getDay() || 7;\n fileDate = new Date(jan4);\n fileDate.setDate(\n jan4.getDate() - dayOfWeek + 1 + (parseInt(week!, 10) - 1) * 7,\n );\n }\n\n if (fileDate && now - fileDate.getTime() > maxAgeMs) {\n try {\n options.unlinkSync(filePath);\n } catch {\n // Ignore errors when deleting files\n }\n }\n }\n }\n\n if (!options.nonBlocking) {\n // Blocking mode implementation\n // deno-lint-ignore no-inner-declarations\n function flushBuffer(): void {\n if (buffer.length > 0) {\n if (shouldRotate()) {\n performRotation();\n }\n const bytes = encoder.encode(buffer);\n buffer = \"\";\n options.writeSync(fd, bytes);\n options.flushSync(fd);\n lastFlushTimestamp = Date.now();\n cleanupOldFiles();\n }\n }\n\n const sink: Sink & Disposable = (record: LogRecord) => {\n buffer += formatter(record);\n\n const shouldFlushBySize = buffer.length >= bufferSize;\n const shouldFlushByTime = flushInterval > 0 &&\n (record.timestamp - lastFlushTimestamp) >= flushInterval;\n\n if (shouldFlushBySize || shouldFlushByTime) {\n flushBuffer();\n }\n };\n\n sink[Symbol.dispose] = () => {\n flushBuffer();\n options.closeSync(fd);\n };\n\n return sink;\n }\n\n // Non-blocking mode implementation\n const asyncOptions = options as AsyncTimeRotatingFileSinkDriver<TFile>;\n let disposed = false;\n let activeFlush: Promise<void> | null = null;\n let flushTimer: ReturnType<typeof setInterval> | null = null;\n\n async function flushBuffer(): Promise<void> {\n if (buffer.length === 0) return;\n\n if (shouldRotate()) {\n performRotation();\n }\n\n const data = buffer;\n buffer = \"\";\n try {\n const bytes = encoder.encode(data);\n asyncOptions.writeSync(fd, bytes);\n await asyncOptions.flush(fd);\n lastFlushTimestamp = Date.now();\n cleanupOldFiles();\n } catch {\n // Silently ignore errors in non-blocking mode\n }\n }\n\n function scheduleFlush(): void {\n if (activeFlush || disposed) return;\n\n activeFlush = flushBuffer().finally(() => {\n activeFlush = null;\n });\n }\n\n function startFlushTimer(): void {\n if (flushTimer !== null || disposed) return;\n\n flushTimer = setInterval(() => {\n scheduleFlush();\n }, flushInterval);\n }\n\n const nonBlockingSink: Sink & AsyncDisposable = (record: LogRecord) => {\n if (disposed) return;\n buffer += formatter(record);\n\n const shouldFlushBySize = buffer.length >= bufferSize;\n const shouldFlushByTime = flushInterval > 0 &&\n (record.timestamp - lastFlushTimestamp) >= flushInterval;\n\n if (shouldFlushBySize || shouldFlushByTime) {\n scheduleFlush();\n } else if (flushTimer === null && flushInterval > 0) {\n startFlushTimer();\n }\n };\n\n nonBlockingSink[Symbol.asyncDispose] = async () => {\n disposed = true;\n if (flushTimer !== null) {\n clearInterval(flushTimer);\n flushTimer = null;\n }\n await flushBuffer();\n try {\n await asyncOptions.close(fd);\n } catch {\n // Writer might already be closed or errored\n }\n };\n\n return non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AACrE,MAAI,SAAU;AACd,YAAU,UAAU,OAAO;EAE3B,MAAM,oBAAoB,OAAO,UAAU;EAC3C,MAAM,oBAAoB,gBAAgB,KACvC,OAAO,YAAY,sBAAuB;AAE7C,MAAI,qBAAqB,kBACvB,gBAAe;WACN,eAAe,QAAQ,gBAAgB,EAChD,kBAAiB;CAEpB;AAED,iBAAgB,OAAO,gBAAgB,YAAY;AACjD,aAAW;AACX,MAAI,eAAe,MAAM;AACvB,iBAAc,WAAW;AACzB,gBAAa;EACd;AACD,QAAM,aAAa;AACnB,MAAI;AACF,SAAM,aAAa,MAAM,GAAG;EAC7B,QAAO,CAEP;CACF;AAED,QAAO;AACR"}
1
+ {"version":3,"file":"timefilesink.js","names":["date: Date","interval: TimeRotationInterval","options:\n & TimeRotatingFileSinkOptions\n & (\n | TimeRotatingFileSinkDriver<TFile>\n | AsyncTimeRotatingFileSinkDriver<TFile>\n )","currentFilename: string","currentPath: string","currentRotationKey: string","fd: TFile","lastFlushTimestamp: number","buffer: string","files: string[]","fileDate: Date | null","flushBuffer","sink: Sink & Disposable","record: LogRecord","activeFlush: Promise<void> | null","flushTimer: ReturnType<typeof setInterval> | null","nonBlockingSink: Sink & AsyncDisposable"],"sources":["../src/timefilesink.ts"],"sourcesContent":["import {\n defaultTextFormatter,\n type LogRecord,\n type Sink,\n} from \"@logtape/logtape\";\nimport type {\n AsyncFileSinkDriver,\n FileSinkDriver,\n FileSinkOptions,\n} from \"./filesink.base.ts\";\n\n/**\n * The rotation interval for time-based file sinks.\n */\nexport type TimeRotationInterval = \"hourly\" | \"daily\" | \"weekly\";\n\n/**\n * Options for the {@link getBaseTimeRotatingFileSink} function.\n */\nexport interface TimeRotatingFileSinkOptions\n extends Omit<FileSinkOptions, \"lazy\"> {\n /**\n * The directory to write log files to.\n */\n directory: string;\n\n /**\n * A function that generates the filename for the log file based on the date.\n * Default depends on `interval`:\n * - `\"daily\"`: `YYYY-MM-DD.log` (e.g., `2025-01-15.log`)\n * - `\"hourly\"`: `YYYY-MM-DD-HH.log` (e.g., `2025-01-15-09.log`)\n * - `\"weekly\"`: `YYYY-WW.log` (e.g., `2025-W03.log`)\n */\n filename?: (date: Date) => string;\n\n /**\n * The rotation interval. Defaults to `\"daily\"`.\n */\n interval?: TimeRotationInterval;\n\n /**\n * The maximum age of log files in milliseconds. Files older than this\n * will be deleted. If not specified, old files are not deleted.\n */\n maxAgeMs?: number;\n}\n\n/**\n * A platform-specific time-rotating file sink driver.\n */\nexport interface TimeRotatingFileSinkDriver<TFile>\n extends FileSinkDriver<TFile> {\n /**\n * Read the contents of a directory.\n * @param path A path to the directory.\n * @returns An array of filenames in the directory.\n */\n readdirSync(path: string): string[];\n\n /**\n * Delete a file.\n * @param path A path to the file to delete.\n */\n unlinkSync(path: string): void;\n\n /**\n * Create a directory if it doesn't exist.\n * @param path A path to the directory to create.\n * @param options Options for directory creation.\n */\n mkdirSync(path: string, options?: { recursive?: boolean }): void;\n\n /**\n * Join path segments.\n * @param paths Path segments to join.\n * @returns The joined path.\n */\n joinPath(...paths: string[]): string;\n}\n\n/**\n * A platform-specific async time-rotating file sink driver.\n * @since 2.0.0\n */\nexport interface AsyncTimeRotatingFileSinkDriver<TFile>\n extends AsyncFileSinkDriver<TFile> {\n /**\n * Read the contents of a directory.\n * @param path A path to the directory.\n * @returns An array of filenames in the directory.\n */\n readdirSync(path: string): string[];\n\n /**\n * Delete a file.\n * @param path A path to the file to delete.\n */\n unlinkSync(path: string): void;\n\n /**\n * Create a directory if it doesn't exist.\n * @param path A path to the directory to create.\n * @param options Options for directory creation.\n */\n mkdirSync(path: string, options?: { recursive?: boolean }): void;\n\n /**\n * Join path segments.\n * @param paths Path segments to join.\n * @returns The joined path.\n */\n joinPath(...paths: string[]): string;\n}\n\n/**\n * Get the ISO week number of a date.\n * @param date The date to get the week number of.\n * @returns The ISO week number (1-53).\n */\nexport function getISOWeek(date: Date): number {\n const d = new Date(\n Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()),\n );\n const dayNum = d.getUTCDay() || 7;\n d.setUTCDate(d.getUTCDate() + 4 - dayNum);\n const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));\n return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);\n}\n\n/**\n * Get the ISO week year of a date. This may differ from the calendar year\n * for dates near the start or end of a year.\n * @param date The date to get the ISO week year of.\n * @returns The ISO week year.\n */\nexport function getISOWeekYear(date: Date): number {\n const d = new Date(\n Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()),\n );\n const dayNum = d.getUTCDay() || 7;\n d.setUTCDate(d.getUTCDate() + 4 - dayNum);\n return d.getUTCFullYear();\n}\n\n/**\n * Get the default filename generator for the given interval.\n * @param interval The rotation interval.\n * @returns A function that generates a filename for a given date.\n */\nexport function getDefaultFilename(\n interval: TimeRotationInterval,\n): (date: Date) => string {\n switch (interval) {\n case \"hourly\":\n return (date: Date): string => {\n const yyyy = date.getFullYear();\n const mm = String(date.getMonth() + 1).padStart(2, \"0\");\n const dd = String(date.getDate()).padStart(2, \"0\");\n const hh = String(date.getHours()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd}-${hh}.log`;\n };\n case \"daily\":\n return (date: Date): string => {\n const yyyy = date.getFullYear();\n const mm = String(date.getMonth() + 1).padStart(2, \"0\");\n const dd = String(date.getDate()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd}.log`;\n };\n case \"weekly\":\n return (date: Date): string => {\n const yyyy = getISOWeekYear(date);\n const week = getISOWeek(date);\n return `${yyyy}-W${String(week).padStart(2, \"0\")}.log`;\n };\n }\n}\n\n/**\n * Get the rotation key for the given date and interval.\n * The key is used to determine when to rotate to a new file.\n * @param date The date to get the rotation key of.\n * @param interval The rotation interval.\n * @returns A string key that changes when rotation should occur.\n */\nfunction getRotationKey(date: Date, interval: TimeRotationInterval): string {\n switch (interval) {\n case \"hourly\":\n return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getHours()}`;\n case \"daily\":\n return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;\n case \"weekly\":\n return `${getISOWeekYear(date)}-${getISOWeek(date)}`;\n }\n}\n\n/**\n * Get a platform-independent time-rotating file sink.\n *\n * This sink writes log records to a file in a directory, rotating to a new\n * file based on time intervals. The filename is generated based on the\n * current date/time and the configured interval.\n *\n * @template TFile The type of the file descriptor.\n * @param options The options for the sink and the file driver.\n * @returns A sink that writes to the file. The sink is also a disposable\n * object that closes the file when disposed. If `nonBlocking` is\n * enabled, returns a sink that also implements {@link AsyncDisposable}.\n */\nexport function getBaseTimeRotatingFileSink<TFile>(\n options: TimeRotatingFileSinkOptions & TimeRotatingFileSinkDriver<TFile>,\n): Sink & Disposable;\nexport function getBaseTimeRotatingFileSink<TFile>(\n options: TimeRotatingFileSinkOptions & AsyncTimeRotatingFileSinkDriver<TFile>,\n): Sink & AsyncDisposable;\nexport function getBaseTimeRotatingFileSink<TFile>(\n options:\n & TimeRotatingFileSinkOptions\n & (\n | TimeRotatingFileSinkDriver<TFile>\n | AsyncTimeRotatingFileSinkDriver<TFile>\n ),\n): Sink & (Disposable | AsyncDisposable) {\n const formatter = options.formatter ?? defaultTextFormatter;\n const encoder = options.encoder ?? new TextEncoder();\n const interval = options.interval ?? \"daily\";\n const filenameGenerator = options.filename ?? getDefaultFilename(interval);\n const maxAgeMs = options.maxAgeMs;\n const bufferSize = options.bufferSize ?? 1024 * 8;\n const flushInterval = options.flushInterval ?? 5000;\n const directory = options.directory;\n\n // Ensure directory exists\n try {\n options.mkdirSync(directory, { recursive: true });\n } catch {\n // Directory might already exist\n }\n\n let currentFilename: string = filenameGenerator(new Date());\n let currentPath: string = options.joinPath(directory, currentFilename);\n let currentRotationKey: string = getRotationKey(new Date(), interval);\n let fd: TFile = options.openSync(currentPath);\n let lastFlushTimestamp: number = Date.now();\n let buffer: string = \"\";\n\n function shouldRotate(): boolean {\n const now = new Date();\n const newKey = getRotationKey(now, interval);\n return newKey !== currentRotationKey;\n }\n\n function performRotation(): void {\n options.closeSync(fd);\n const now = new Date();\n currentFilename = filenameGenerator(now);\n currentPath = options.joinPath(directory, currentFilename);\n currentRotationKey = getRotationKey(now, interval);\n fd = options.openSync(currentPath);\n }\n\n function cleanupOldFiles(): void {\n if (maxAgeMs === undefined) return;\n\n const now = Date.now();\n let files: string[];\n try {\n files = options.readdirSync(directory);\n } catch {\n return;\n }\n\n for (const file of files) {\n if (!file.endsWith(\".log\")) continue;\n if (file === currentFilename) continue;\n\n const filePath = options.joinPath(directory, file);\n\n // Try to parse the date from the filename\n const dateMatch = file.match(\n /^(\\d{4})-(\\d{2})-(\\d{2})(?:-(\\d{2}))?\\.log$/,\n );\n const weekMatch = file.match(/^(\\d{4})-W(\\d{2})\\.log$/);\n\n let fileDate: Date | null = null;\n\n if (dateMatch) {\n const [, year, month, day, hour] = dateMatch;\n fileDate = new Date(\n parseInt(year!, 10),\n parseInt(month!, 10) - 1,\n parseInt(day!, 10),\n hour ? parseInt(hour, 10) : 0,\n );\n } else if (weekMatch) {\n const [, year, week] = weekMatch;\n // Get the date of the first day of the week\n const jan4 = new Date(parseInt(year!, 10), 0, 4);\n const dayOfWeek = jan4.getDay() || 7;\n fileDate = new Date(jan4);\n fileDate.setDate(\n jan4.getDate() - dayOfWeek + 1 + (parseInt(week!, 10) - 1) * 7,\n );\n }\n\n if (fileDate && now - fileDate.getTime() > maxAgeMs) {\n try {\n options.unlinkSync(filePath);\n } catch {\n // Ignore errors when deleting files\n }\n }\n }\n }\n\n if (!options.nonBlocking) {\n // Blocking mode implementation\n // deno-lint-ignore no-inner-declarations\n function flushBuffer(): void {\n if (buffer.length > 0) {\n if (shouldRotate()) {\n performRotation();\n }\n const bytes = encoder.encode(buffer);\n buffer = \"\";\n options.writeSync(fd, bytes);\n options.flushSync(fd);\n lastFlushTimestamp = Date.now();\n cleanupOldFiles();\n }\n }\n\n const sink: Sink & Disposable = (record: LogRecord) => {\n buffer += formatter(record);\n\n const shouldFlushBySize = buffer.length >= bufferSize;\n const shouldFlushByTime = flushInterval > 0 &&\n (record.timestamp - lastFlushTimestamp) >= flushInterval;\n\n if (shouldFlushBySize || shouldFlushByTime) {\n flushBuffer();\n }\n };\n\n sink[Symbol.dispose] = () => {\n flushBuffer();\n options.closeSync(fd);\n };\n\n return sink;\n }\n\n // Non-blocking mode implementation\n const asyncOptions = options as AsyncTimeRotatingFileSinkDriver<TFile>;\n let disposed = false;\n let activeFlush: Promise<void> | null = null;\n let flushTimer: ReturnType<typeof setInterval> | null = null;\n\n async function flushBuffer(): Promise<void> {\n if (buffer.length === 0) return;\n\n if (shouldRotate()) {\n performRotation();\n }\n\n const data = buffer;\n buffer = \"\";\n try {\n const bytes = encoder.encode(data);\n asyncOptions.writeSync(fd, bytes);\n await asyncOptions.flush(fd);\n lastFlushTimestamp = Date.now();\n cleanupOldFiles();\n } catch {\n // Silently ignore errors in non-blocking mode\n }\n }\n\n function scheduleFlush(): void {\n if (activeFlush || disposed) return;\n\n activeFlush = flushBuffer().finally(() => {\n activeFlush = null;\n });\n }\n\n function startFlushTimer(): void {\n if (flushTimer !== null || disposed) return;\n\n flushTimer = setInterval(() => {\n scheduleFlush();\n }, flushInterval);\n }\n\n const nonBlockingSink: Sink & AsyncDisposable = (record: LogRecord) => {\n if (disposed) return;\n buffer += formatter(record);\n\n const shouldFlushBySize = buffer.length >= bufferSize;\n const shouldFlushByTime = flushInterval > 0 &&\n (record.timestamp - lastFlushTimestamp) >= flushInterval;\n\n if (shouldFlushBySize || shouldFlushByTime) {\n scheduleFlush();\n } else if (flushTimer === null && flushInterval > 0) {\n startFlushTimer();\n }\n };\n\n nonBlockingSink[Symbol.asyncDispose] = async () => {\n disposed = true;\n if (flushTimer !== null) {\n clearInterval(flushTimer);\n flushTimer = null;\n }\n await flushBuffer();\n try {\n await asyncOptions.close(fd);\n } catch {\n // Writer might already be closed or errored\n }\n };\n\n return nonBlockingSink;\n}\n"],"mappings":";;;;;;;;AAuHA,SAAgB,WAAWA,MAAoB;CAC7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O,UAAU;EAC3C,MAAM,oBAAoB,gBAAgB,KACvC,OAAO,YAAY,sBAAuB;AAE7C,MAAI,qBAAqB,kBACvB,gBAAe;WACN,eAAe,QAAQ,gBAAgB,EAChD,kBAAiB;CAEpB;AAED,iBAAgB,OAAO,gBAAgB,YAAY;AACjD,aAAW;AACX,MAAI,eAAe,MAAM;AACvB,iBAAc,WAAW;AACzB,gBAAa;EACd;AACD,QAAM,aAAa;AACnB,MAAI;AACF,SAAM,aAAa,MAAM,GAAG;EAC7B,QAAO,CAEP;CACF;AAED,QAAO;AACR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logtape/file",
3
- "version": "1.4.0-dev.468+3b71b201",
3
+ "version": "2.0.0-dev.470+4d317130",
4
4
  "description": "File sink and rotating file sink for LogTape",
5
5
  "keywords": [
6
6
  "logging",
@@ -60,7 +60,7 @@
60
60
  "dist/"
61
61
  ],
62
62
  "peerDependencies": {
63
- "@logtape/logtape": "^1.4.0-dev.468+3b71b201"
63
+ "@logtape/logtape": "^2.0.0-dev.470+4d317130"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@alinea/suite": "^0.6.3",