@logtape/file 1.4.0-dev.444 → 1.4.0-dev.445

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 (73) hide show
  1. package/dist/filesink.base.d.cts +1 -1
  2. package/dist/filesink.base.d.ts +1 -1
  3. package/dist/filesink.deno.cjs +46 -1
  4. package/dist/filesink.deno.d.cts +31 -1
  5. package/dist/filesink.deno.d.cts.map +1 -1
  6. package/dist/filesink.deno.d.ts +31 -1
  7. package/dist/filesink.deno.d.ts.map +1 -1
  8. package/dist/filesink.deno.js +43 -1
  9. package/dist/filesink.deno.js.map +1 -1
  10. package/dist/filesink.node.cjs +38 -1
  11. package/dist/filesink.node.d.cts +31 -1
  12. package/dist/filesink.node.d.cts.map +1 -1
  13. package/dist/filesink.node.d.ts +31 -1
  14. package/dist/filesink.node.d.ts.map +1 -1
  15. package/dist/filesink.node.js +35 -1
  16. package/dist/filesink.node.js.map +1 -1
  17. package/dist/mod.cjs +7 -1
  18. package/dist/mod.d.cts +3 -2
  19. package/dist/mod.d.ts +3 -2
  20. package/dist/mod.js +2 -2
  21. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.cjs +8 -0
  22. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.js +8 -0
  23. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.js.map +1 -0
  24. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/constants.cjs +20 -0
  25. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/constants.js +13 -0
  26. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/constants.js.map +1 -0
  27. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/from_file_url.cjs +10 -0
  28. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/from_file_url.js +10 -0
  29. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/from_file_url.js.map +1 -0
  30. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize.cjs +10 -0
  31. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize.js +11 -0
  32. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize.js.map +1 -0
  33. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize_string.cjs +56 -0
  34. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize_string.js +57 -0
  35. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize_string.js.map +1 -0
  36. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_os.cjs +6 -0
  37. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_os.js +6 -0
  38. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_os.js.map +1 -0
  39. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/join.cjs +31 -0
  40. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/join.js +32 -0
  41. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/join.js.map +1 -0
  42. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/_util.cjs +9 -0
  43. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/_util.js +10 -0
  44. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/_util.js.map +1 -0
  45. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/from_file_url.cjs +23 -0
  46. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/from_file_url.js +24 -0
  47. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/from_file_url.js.map +1 -0
  48. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/join.cjs +44 -0
  49. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/join.js +45 -0
  50. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/join.js.map +1 -0
  51. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/normalize.cjs +54 -0
  52. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/normalize.js +55 -0
  53. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/normalize.js.map +1 -0
  54. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/_util.cjs +13 -0
  55. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/_util.js +13 -0
  56. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/_util.js.map +1 -0
  57. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/from_file_url.cjs +27 -0
  58. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/from_file_url.js +28 -0
  59. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/from_file_url.js.map +1 -0
  60. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/join.cjs +51 -0
  61. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/join.js +52 -0
  62. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/join.js.map +1 -0
  63. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/normalize.cjs +82 -0
  64. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/normalize.js +83 -0
  65. package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/normalize.js.map +1 -0
  66. package/dist/timefilesink.cjs +208 -0
  67. package/dist/timefilesink.d.cts +104 -0
  68. package/dist/timefilesink.d.cts.map +1 -0
  69. package/dist/timefilesink.d.ts +104 -0
  70. package/dist/timefilesink.d.ts.map +1 -0
  71. package/dist/timefilesink.js +208 -0
  72. package/dist/timefilesink.js.map +1 -0
  73. package/package.json +2 -2
@@ -172,5 +172,5 @@ interface AsyncRotatingFileSinkDriver<TFile> extends AsyncFileSinkDriver<TFile>
172
172
  * returns a sink that also implements {@link AsyncDisposable}.
173
173
  */
174
174
  //#endregion
175
- export { AsyncRotatingFileSinkDriver, FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions };
175
+ export { AsyncFileSinkDriver, AsyncRotatingFileSinkDriver, FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions };
176
176
  //# sourceMappingURL=filesink.base.d.cts.map
@@ -172,5 +172,5 @@ interface AsyncRotatingFileSinkDriver<TFile> extends AsyncFileSinkDriver<TFile>
172
172
  * returns a sink that also implements {@link AsyncDisposable}.
173
173
  */
174
174
  //#endregion
175
- export { AsyncRotatingFileSinkDriver, FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions };
175
+ export { AsyncFileSinkDriver, AsyncRotatingFileSinkDriver, FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions };
176
176
  //# sourceMappingURL=filesink.base.d.ts.map
@@ -1,4 +1,6 @@
1
+ const require_join = require('./node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/join.cjs');
1
2
  const require_filesink_base = require('./filesink.base.cjs');
3
+ const require_timefilesink = require('./timefilesink.cjs');
2
4
 
3
5
  //#region src/filesink.deno.ts
4
6
  /**
@@ -42,6 +44,36 @@ const denoAsyncDriver = {
42
44
  return Promise.resolve(fd.close());
43
45
  }
44
46
  };
47
+ /**
48
+ * A Deno-specific time-rotating file sink driver.
49
+ * @since 1.4.0
50
+ */
51
+ const denoTimeDriver = {
52
+ ...denoDriver,
53
+ readdirSync(path) {
54
+ return [...Deno.readDirSync(path)].map((entry) => entry.name);
55
+ },
56
+ unlinkSync: globalThis?.Deno.removeSync,
57
+ mkdirSync(path, options) {
58
+ Deno.mkdirSync(path, options);
59
+ },
60
+ joinPath: require_join.join
61
+ };
62
+ /**
63
+ * A Deno-specific async time-rotating file sink driver.
64
+ * @since 1.4.0
65
+ */
66
+ const denoAsyncTimeDriver = {
67
+ ...denoAsyncDriver,
68
+ readdirSync(path) {
69
+ return [...Deno.readDirSync(path)].map((entry) => entry.name);
70
+ },
71
+ unlinkSync: globalThis?.Deno.removeSync,
72
+ mkdirSync(path, options) {
73
+ Deno.mkdirSync(path, options);
74
+ },
75
+ joinPath: require_join.join
76
+ };
45
77
  function getFileSink(path, options = {}) {
46
78
  if (options.nonBlocking) return require_filesink_base.getBaseFileSink(path, {
47
79
  ...options,
@@ -62,9 +94,22 @@ function getRotatingFileSink(path, options = {}) {
62
94
  ...denoDriver
63
95
  });
64
96
  }
97
+ function getTimeRotatingFileSink(options) {
98
+ if (options.nonBlocking) return require_timefilesink.getBaseTimeRotatingFileSink({
99
+ ...options,
100
+ ...denoAsyncTimeDriver
101
+ });
102
+ return require_timefilesink.getBaseTimeRotatingFileSink({
103
+ ...options,
104
+ ...denoTimeDriver
105
+ });
106
+ }
65
107
 
66
108
  //#endregion
67
109
  exports.denoAsyncDriver = denoAsyncDriver;
110
+ exports.denoAsyncTimeDriver = denoAsyncTimeDriver;
68
111
  exports.denoDriver = denoDriver;
112
+ exports.denoTimeDriver = denoTimeDriver;
69
113
  exports.getFileSink = getFileSink;
70
- exports.getRotatingFileSink = getRotatingFileSink;
114
+ exports.getRotatingFileSink = getRotatingFileSink;
115
+ exports.getTimeRotatingFileSink = getTimeRotatingFileSink;
@@ -1,4 +1,5 @@
1
1
  import { AsyncRotatingFileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions } from "./filesink.base.cjs";
2
+ import { AsyncTimeRotatingFileSinkDriver, TimeRotatingFileSinkDriver, TimeRotatingFileSinkOptions } from "./timefilesink.cjs";
2
3
  import { Sink } from "@logtape/logtape";
3
4
 
4
5
  //#region src/filesink.deno.d.ts
@@ -12,6 +13,16 @@ declare const denoDriver: RotatingFileSinkDriver<Deno.FsFile>;
12
13
  * @since 1.0.0
13
14
  */
14
15
  declare const denoAsyncDriver: AsyncRotatingFileSinkDriver<Deno.FsFile>;
16
+ /**
17
+ * A Deno-specific time-rotating file sink driver.
18
+ * @since 1.4.0
19
+ */
20
+ declare const denoTimeDriver: TimeRotatingFileSinkDriver<Deno.FsFile>;
21
+ /**
22
+ * A Deno-specific async time-rotating file sink driver.
23
+ * @since 1.4.0
24
+ */
25
+ declare const denoAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<Deno.FsFile>;
15
26
  /**
16
27
  * Get a file sink.
17
28
  *
@@ -47,7 +58,26 @@ declare function getRotatingFileSink(path: string, options?: RotatingFileSinkOpt
47
58
  declare function getRotatingFileSink(path: string, options: RotatingFileSinkOptions & {
48
59
  nonBlocking: true;
49
60
  }): Sink & AsyncDisposable;
61
+ /**
62
+ * Get a time-rotating file sink.
63
+ *
64
+ * This sink writes log records to a file in a directory, rotating to a new
65
+ * file based on time intervals. The filename is generated based on the
66
+ * current date/time and the configured interval.
67
+ *
68
+ * Note that this function is unavailable in the browser.
69
+ *
70
+ * @param options The options for the sink.
71
+ * @returns A sink that writes to the file. The sink is also a disposable
72
+ * object that closes the file when disposed. If `nonBlocking` is
73
+ * enabled, returns a sink that also implements {@link AsyncDisposable}.
74
+ * @since 1.4.0
75
+ */
76
+ declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions): Sink & Disposable;
77
+ declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions & {
78
+ nonBlocking: true;
79
+ }): Sink & AsyncDisposable;
50
80
  //# sourceMappingURL=filesink.deno.d.ts.map
51
81
  //#endregion
52
- export { denoAsyncDriver, denoDriver, getFileSink, getRotatingFileSink };
82
+ export { denoAsyncDriver, denoAsyncTimeDriver, denoDriver, denoTimeDriver, getFileSink, getRotatingFileSink, getTimeRotatingFileSink };
53
83
  //# sourceMappingURL=filesink.deno.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filesink.deno.d.cts","names":[],"sources":["../src/filesink.deno.ts"],"sourcesContent":[],"mappings":";;;;;;;AAaA;AAsBC,cAtBY,UAsBZ,EAtBwB,sBAsBxB,CAtB+C,IAAA,CAAK,MAsBpD,CAAA;;;AAtB8C;AA4B/C;AAeC,cAfY,eAeZ,EAf6B,2BAe7B,CAfyD,IAAA,CAAK,MAe9D,CAAA;;;AAfwD;AA4BzD;;;;;AAGoB;AACpB;;AAEW,iBANK,WAAA,CAML,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAJC,eAID,CAAA,EAHR,IAGQ,GAHD,UAGC;AACR,iBAHa,WAAA,CAGb,IAAA,EAAA,MAAA,EAAA,OAAA,EADQ,eACR,GAAA;EAAI,WAAG,EAAA,IAAA;AAAe,CAAA,CAAA,EAAtB,IAAsB,GAAf,eAAe;AA2BzB;;;;;AAGoB;AACpB;;;;;AAGyB;;;;;iBAPT,mBAAA,yBAEJ,0BACT,OAAO;iBACM,mBAAA,wBAEL;;IACR,OAAO"}
1
+ {"version":3,"file":"filesink.deno.d.cts","names":[],"sources":["../src/filesink.deno.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAoBA;AAsBC,cAtBY,UAsBZ,EAtBwB,sBAsBxB,CAtB+C,IAAA,CAAK,MAsBpD,CAAA;;;AAtB8C;AA4B/C;AAeC,cAfY,eAeZ,EAf6B,2BAe7B,CAfyD,IAAA,CAAK,MAe9D,CAAA;;;AAfwD;AAqBzD;AAUC,cAVY,cAUZ,EAV4B,0BAU5B,CAVuD,IAAA,CAAK,MAU5D,CAAA;;;AAVsD;AAgBvD;AAWG,cAXU,mBAWV,EAX+B,+BAW/B,CAX+D,IAAA,CAAK,MAWpE,CAAA;;;AAX8D;AAwBjE;;;;;AAGoB;AACpB;;AAEW,iBANK,WAAA,CAML,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAJC,eAID,CAAA,EAHR,IAGQ,GAHD,UAGC;AACR,iBAHa,WAAA,CAGb,IAAA,EAAA,MAAA,EAAA,OAAA,EADQ,eACR,GAAA;EAAI,WAAG,EAAA,IAAA;AAAe,CAAA,CAAA,EAAtB,IAAsB,GAAf,eAAe;AA2BzB;;;;;AAGoB;AACpB;;;;;AAGyB;AA0BzB;;;;AAEU,iBAnCM,mBAAA,CAmCN,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAjCE,uBAiCF,CAAA,EAhCP,IAgCO,GAhCA,UAgCA;AAAU,iBA/BJ,mBAAA,CA+BI,IAAA,EAAA,MAAA,EAAA,OAAA,EA7BT,uBA6BS,GAAA;EACJ,WAAA,EAAA,IAAA;CAAuB,CAAA,EA7BpC,IA6BoC,GA7B7B,eA6B6B;;;;AAEd;;;;;;;;;;;;iBALT,uBAAA,UACL,8BACR,OAAO;iBACM,uBAAA,UACL;;IACR,OAAO"}
@@ -1,4 +1,5 @@
1
1
  import { AsyncRotatingFileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions } from "./filesink.base.js";
2
+ import { AsyncTimeRotatingFileSinkDriver, TimeRotatingFileSinkDriver, TimeRotatingFileSinkOptions } from "./timefilesink.js";
2
3
  import { Sink } from "@logtape/logtape";
3
4
 
4
5
  //#region src/filesink.deno.d.ts
@@ -12,6 +13,16 @@ declare const denoDriver: RotatingFileSinkDriver<Deno.FsFile>;
12
13
  * @since 1.0.0
13
14
  */
14
15
  declare const denoAsyncDriver: AsyncRotatingFileSinkDriver<Deno.FsFile>;
16
+ /**
17
+ * A Deno-specific time-rotating file sink driver.
18
+ * @since 1.4.0
19
+ */
20
+ declare const denoTimeDriver: TimeRotatingFileSinkDriver<Deno.FsFile>;
21
+ /**
22
+ * A Deno-specific async time-rotating file sink driver.
23
+ * @since 1.4.0
24
+ */
25
+ declare const denoAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<Deno.FsFile>;
15
26
  /**
16
27
  * Get a file sink.
17
28
  *
@@ -47,7 +58,26 @@ declare function getRotatingFileSink(path: string, options?: RotatingFileSinkOpt
47
58
  declare function getRotatingFileSink(path: string, options: RotatingFileSinkOptions & {
48
59
  nonBlocking: true;
49
60
  }): Sink & AsyncDisposable;
61
+ /**
62
+ * Get a time-rotating file sink.
63
+ *
64
+ * This sink writes log records to a file in a directory, rotating to a new
65
+ * file based on time intervals. The filename is generated based on the
66
+ * current date/time and the configured interval.
67
+ *
68
+ * Note that this function is unavailable in the browser.
69
+ *
70
+ * @param options The options for the sink.
71
+ * @returns A sink that writes to the file. The sink is also a disposable
72
+ * object that closes the file when disposed. If `nonBlocking` is
73
+ * enabled, returns a sink that also implements {@link AsyncDisposable}.
74
+ * @since 1.4.0
75
+ */
76
+ declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions): Sink & Disposable;
77
+ declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions & {
78
+ nonBlocking: true;
79
+ }): Sink & AsyncDisposable;
50
80
  //# sourceMappingURL=filesink.deno.d.ts.map
51
81
  //#endregion
52
- export { denoAsyncDriver, denoDriver, getFileSink, getRotatingFileSink };
82
+ export { denoAsyncDriver, denoAsyncTimeDriver, denoDriver, denoTimeDriver, getFileSink, getRotatingFileSink, getTimeRotatingFileSink };
53
83
  //# sourceMappingURL=filesink.deno.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filesink.deno.d.ts","names":[],"sources":["../src/filesink.deno.ts"],"sourcesContent":[],"mappings":";;;;;;;AAaA;AAsBC,cAtBY,UAsBZ,EAtBwB,sBAsBxB,CAtB+C,IAAA,CAAK,MAsBpD,CAAA;;;AAtB8C;AA4B/C;AAeC,cAfY,eAeZ,EAf6B,2BAe7B,CAfyD,IAAA,CAAK,MAe9D,CAAA;;;AAfwD;AA4BzD;;;;;AAGoB;AACpB;;AAEW,iBANK,WAAA,CAML,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAJC,eAID,CAAA,EAHR,IAGQ,GAHD,UAGC;AACR,iBAHa,WAAA,CAGb,IAAA,EAAA,MAAA,EAAA,OAAA,EADQ,eACR,GAAA;EAAI,WAAG,EAAA,IAAA;AAAe,CAAA,CAAA,EAAtB,IAAsB,GAAf,eAAe;AA2BzB;;;;;AAGoB;AACpB;;;;;AAGyB;;;;;iBAPT,mBAAA,yBAEJ,0BACT,OAAO;iBACM,mBAAA,wBAEL;;IACR,OAAO"}
1
+ {"version":3,"file":"filesink.deno.d.ts","names":[],"sources":["../src/filesink.deno.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAoBA;AAsBC,cAtBY,UAsBZ,EAtBwB,sBAsBxB,CAtB+C,IAAA,CAAK,MAsBpD,CAAA;;;AAtB8C;AA4B/C;AAeC,cAfY,eAeZ,EAf6B,2BAe7B,CAfyD,IAAA,CAAK,MAe9D,CAAA;;;AAfwD;AAqBzD;AAUC,cAVY,cAUZ,EAV4B,0BAU5B,CAVuD,IAAA,CAAK,MAU5D,CAAA;;;AAVsD;AAgBvD;AAWG,cAXU,mBAWV,EAX+B,+BAW/B,CAX+D,IAAA,CAAK,MAWpE,CAAA;;;AAX8D;AAwBjE;;;;;AAGoB;AACpB;;AAEW,iBANK,WAAA,CAML,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAJC,eAID,CAAA,EAHR,IAGQ,GAHD,UAGC;AACR,iBAHa,WAAA,CAGb,IAAA,EAAA,MAAA,EAAA,OAAA,EADQ,eACR,GAAA;EAAI,WAAG,EAAA,IAAA;AAAe,CAAA,CAAA,EAAtB,IAAsB,GAAf,eAAe;AA2BzB;;;;;AAGoB;AACpB;;;;;AAGyB;AA0BzB;;;;AAEU,iBAnCM,mBAAA,CAmCN,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAjCE,uBAiCF,CAAA,EAhCP,IAgCO,GAhCA,UAgCA;AAAU,iBA/BJ,mBAAA,CA+BI,IAAA,EAAA,MAAA,EAAA,OAAA,EA7BT,uBA6BS,GAAA;EACJ,WAAA,EAAA,IAAA;CAAuB,CAAA,EA7BpC,IA6BoC,GA7B7B,eA6B6B;;;;AAEd;;;;;;;;;;;;iBALT,uBAAA,UACL,8BACR,OAAO;iBACM,uBAAA,UACL;;IACR,OAAO"}
@@ -1,4 +1,6 @@
1
+ import { join } from "./node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/join.js";
1
2
  import { getBaseFileSink, getBaseRotatingFileSink } from "./filesink.base.js";
3
+ import { getBaseTimeRotatingFileSink } from "./timefilesink.js";
2
4
 
3
5
  //#region src/filesink.deno.ts
4
6
  /**
@@ -42,6 +44,36 @@ const denoAsyncDriver = {
42
44
  return Promise.resolve(fd.close());
43
45
  }
44
46
  };
47
+ /**
48
+ * A Deno-specific time-rotating file sink driver.
49
+ * @since 1.4.0
50
+ */
51
+ const denoTimeDriver = {
52
+ ...denoDriver,
53
+ readdirSync(path) {
54
+ return [...Deno.readDirSync(path)].map((entry) => entry.name);
55
+ },
56
+ unlinkSync: globalThis?.Deno.removeSync,
57
+ mkdirSync(path, options) {
58
+ Deno.mkdirSync(path, options);
59
+ },
60
+ joinPath: join
61
+ };
62
+ /**
63
+ * A Deno-specific async time-rotating file sink driver.
64
+ * @since 1.4.0
65
+ */
66
+ const denoAsyncTimeDriver = {
67
+ ...denoAsyncDriver,
68
+ readdirSync(path) {
69
+ return [...Deno.readDirSync(path)].map((entry) => entry.name);
70
+ },
71
+ unlinkSync: globalThis?.Deno.removeSync,
72
+ mkdirSync(path, options) {
73
+ Deno.mkdirSync(path, options);
74
+ },
75
+ joinPath: join
76
+ };
45
77
  function getFileSink(path, options = {}) {
46
78
  if (options.nonBlocking) return getBaseFileSink(path, {
47
79
  ...options,
@@ -62,7 +94,17 @@ function getRotatingFileSink(path, options = {}) {
62
94
  ...denoDriver
63
95
  });
64
96
  }
97
+ function getTimeRotatingFileSink(options) {
98
+ if (options.nonBlocking) return getBaseTimeRotatingFileSink({
99
+ ...options,
100
+ ...denoAsyncTimeDriver
101
+ });
102
+ return getBaseTimeRotatingFileSink({
103
+ ...options,
104
+ ...denoTimeDriver
105
+ });
106
+ }
65
107
 
66
108
  //#endregion
67
- export { denoAsyncDriver, denoDriver, getFileSink, getRotatingFileSink };
109
+ export { denoAsyncDriver, denoAsyncTimeDriver, denoDriver, denoTimeDriver, getFileSink, getRotatingFileSink, getTimeRotatingFileSink };
68
110
  //# sourceMappingURL=filesink.deno.js.map
@@ -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>","options: FileSinkOptions","options: RotatingFileSinkOptions"],"sources":["../src/filesink.deno.ts"],"sourcesContent":["import type { Sink } from \"@logtape/logtape\";\nimport {\n type AsyncRotatingFileSinkDriver,\n type FileSinkOptions,\n getBaseFileSink,\n getBaseRotatingFileSink,\n type RotatingFileSinkDriver,\n type RotatingFileSinkOptions,\n} from \"./filesink.base.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 * 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// cSpell: ignore filesink\n"],"mappings":";;;;;;AAaA,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;CACD,UAAU,YAAY,KAAK;CAC3B,YAAY,YAAY,KAAK;AAC9B;;;;;AAMD,MAAaC,kBAA4D;CACvE,GAAG;CACH,MAAM,UAAUF,IAAiBC,QAAqC;AAGpE,OAAK,MAAM,SAAS,OAClB,OAAM,GAAG,MAAM,MAAM;CAExB;CACD,MAAM,MAAM,IAAI;AACd,QAAM,GAAG,MAAM;CAChB;CACD,MAAM,IAAI;AACR,SAAO,QAAQ,QAAQ,GAAG,OAAO,CAAC;CACnC;AACF;AAqBD,SAAgB,YACdF,MACAI,UAA2B,CAAE,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,oBACdJ,MACAK,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"}
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;CACD,UAAU,YAAY,KAAK;CAC3B,YAAY,YAAY,KAAK;AAC9B;;;;;AAMD,MAAaC,kBAA4D;CACvE,GAAG;CACH,MAAM,UAAUF,IAAiBC,QAAqC;AAGpE,OAAK,MAAM,SAAS,OAClB,OAAM,GAAG,MAAM,MAAM;CAExB;CACD,MAAM,MAAM,IAAI;AACd,QAAM,GAAG,MAAM;CAChB;CACD,MAAM,IAAI;AACR,SAAO,QAAQ,QAAQ,GAAG,OAAO,CAAC;CACnC;AACF;;;;;AAMD,MAAaE,iBAA0D;CACrE,GAAG;CACH,YAAYJ,MAAc;AACxB,SAAO,CAAC,GAAG,KAAK,YAAY,KAAK,AAAC,EAAC,IAAI,CAAC,UAAU,MAAM,KAAK;CAC9D;CACD,YAAY,YAAY,KAAK;CAC7B,UAAUA,MAAcK,SAAmC;AACzD,OAAK,UAAU,MAAM,QAAQ;CAC9B;CACD,UAAU;AACX;;;;;AAMD,MAAaC,sBACX;CACE,GAAG;CACH,YAAYN,MAAc;AACxB,SAAO,CAAC,GAAG,KAAK,YAAY,KAAK,AAAC,EAAC,IAAI,CAAC,UAAU,MAAM,KAAK;CAC9D;CACD,YAAY,YAAY,KAAK;CAC7B,UAAUA,MAAcK,SAAmC;AACzD,OAAK,UAAU,MAAM,QAAQ;CAC9B;CACD,UAAU;AACX;AAqBH,SAAgB,YACdL,MACAO,UAA2B,CAAE,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"}
@@ -1,6 +1,8 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  const require_filesink_base = require('./filesink.base.cjs');
3
+ const require_timefilesink = require('./timefilesink.cjs');
3
4
  const node_fs = require_rolldown_runtime.__toESM(require("node:fs"));
5
+ const node_path = require_rolldown_runtime.__toESM(require("node:path"));
4
6
  const node_util = require_rolldown_runtime.__toESM(require("node:util"));
5
7
 
6
8
  //#region src/filesink.node.ts
@@ -42,6 +44,28 @@ const nodeAsyncDriver = {
42
44
  flush: (0, node_util.promisify)(node_fs.default.fsync),
43
45
  close: (0, node_util.promisify)(node_fs.default.close)
44
46
  };
47
+ /**
48
+ * A Node.js-specific time-rotating file sink driver.
49
+ * @since 1.4.0
50
+ */
51
+ const nodeTimeDriver = {
52
+ ...nodeDriver,
53
+ readdirSync: node_fs.default.readdirSync,
54
+ unlinkSync: node_fs.default.unlinkSync,
55
+ mkdirSync: node_fs.default.mkdirSync,
56
+ joinPath: node_path.join
57
+ };
58
+ /**
59
+ * A Node.js-specific async time-rotating file sink driver.
60
+ * @since 1.4.0
61
+ */
62
+ const nodeAsyncTimeDriver = {
63
+ ...nodeAsyncDriver,
64
+ readdirSync: node_fs.default.readdirSync,
65
+ unlinkSync: node_fs.default.unlinkSync,
66
+ mkdirSync: node_fs.default.mkdirSync,
67
+ joinPath: node_path.join
68
+ };
45
69
  function getFileSink(path, options = {}) {
46
70
  if (options.nonBlocking) return require_filesink_base.getBaseFileSink(path, {
47
71
  ...options,
@@ -62,9 +86,22 @@ function getRotatingFileSink(path, options = {}) {
62
86
  ...nodeDriver
63
87
  });
64
88
  }
89
+ function getTimeRotatingFileSink(options) {
90
+ if (options.nonBlocking) return require_timefilesink.getBaseTimeRotatingFileSink({
91
+ ...options,
92
+ ...nodeAsyncTimeDriver
93
+ });
94
+ return require_timefilesink.getBaseTimeRotatingFileSink({
95
+ ...options,
96
+ ...nodeTimeDriver
97
+ });
98
+ }
65
99
 
66
100
  //#endregion
67
101
  exports.getFileSink = getFileSink;
68
102
  exports.getRotatingFileSink = getRotatingFileSink;
103
+ exports.getTimeRotatingFileSink = getTimeRotatingFileSink;
69
104
  exports.nodeAsyncDriver = nodeAsyncDriver;
70
- exports.nodeDriver = nodeDriver;
105
+ exports.nodeAsyncTimeDriver = nodeAsyncTimeDriver;
106
+ exports.nodeDriver = nodeDriver;
107
+ exports.nodeTimeDriver = nodeTimeDriver;
@@ -1,4 +1,5 @@
1
1
  import { AsyncRotatingFileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions } from "./filesink.base.cjs";
2
+ import { AsyncTimeRotatingFileSinkDriver, TimeRotatingFileSinkDriver, TimeRotatingFileSinkOptions } from "./timefilesink.cjs";
2
3
  import { Sink } from "@logtape/logtape";
3
4
 
4
5
  //#region src/filesink.node.d.ts
@@ -12,6 +13,16 @@ declare const nodeDriver: RotatingFileSinkDriver<number | void>;
12
13
  * @since 1.0.0
13
14
  */
14
15
  declare const nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void>;
16
+ /**
17
+ * A Node.js-specific time-rotating file sink driver.
18
+ * @since 1.4.0
19
+ */
20
+ declare const nodeTimeDriver: TimeRotatingFileSinkDriver<number | void>;
21
+ /**
22
+ * A Node.js-specific async time-rotating file sink driver.
23
+ * @since 1.4.0
24
+ */
25
+ declare const nodeAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<number | void>;
15
26
  /**
16
27
  * Get a file sink.
17
28
  *
@@ -47,7 +58,26 @@ declare function getRotatingFileSink(path: string, options?: RotatingFileSinkOpt
47
58
  declare function getRotatingFileSink(path: string, options: RotatingFileSinkOptions & {
48
59
  nonBlocking: true;
49
60
  }): Sink & AsyncDisposable;
61
+ /**
62
+ * Get a time-rotating file sink.
63
+ *
64
+ * This sink writes log records to a file in a directory, rotating to a new
65
+ * file based on time intervals. The filename is generated based on the
66
+ * current date/time and the configured interval.
67
+ *
68
+ * Note that this function is unavailable in the browser.
69
+ *
70
+ * @param options The options for the sink.
71
+ * @returns A sink that writes to the file. The sink is also a disposable
72
+ * object that closes the file when disposed. If `nonBlocking` is
73
+ * enabled, returns a sink that also implements {@link AsyncDisposable}.
74
+ * @since 1.4.0
75
+ */
76
+ declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions): Sink & Disposable;
77
+ declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions & {
78
+ nonBlocking: true;
79
+ }): Sink & AsyncDisposable;
50
80
  //# sourceMappingURL=filesink.node.d.ts.map
51
81
  //#endregion
52
- export { getFileSink, getRotatingFileSink, nodeAsyncDriver, nodeDriver };
82
+ export { getFileSink, getRotatingFileSink, getTimeRotatingFileSink, nodeAsyncDriver, nodeAsyncTimeDriver, nodeDriver, nodeTimeDriver };
53
83
  //# sourceMappingURL=filesink.node.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filesink.node.d.cts","names":[],"sources":["../src/filesink.node.ts"],"sourcesContent":[],"mappings":";;;;;;;AAeA;AAwBa,cAxBA,UAqCZ,EArCwB,sBAwBK,CAAA,MAA2B,GAAA,IAAA,CAAA;AA0BzD;;;;AAGU,cA7BG,eA6BH,EA7BoB,2BA6BpB,CAAA,MAAA,GAAA,IAAA,CAAA;AAAU;AACpB;;;;;AAGyB;AA2BzB;;;;AAGU,iBArCM,WAAA,CAqCN,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAnCE,eAmCF,CAAA,EAlCP,IAkCO,GAlCA,UAkCA;AAAU,iBAjCJ,WAAA,CAiCI,IAAA,EAAA,MAAA,EAAA,OAAA,EA/BT,eA+BS,GAAA;EACJ,WAAA,EAAA,IAAA;CAAmB,CAAA,EA/BhC,IA+BgC,GA/BzB,eA+ByB;;;;AAGV;;;;;;;;;;;;;iBAPT,mBAAA,yBAEJ,0BACT,OAAO;iBACM,mBAAA,wBAEL;;IACR,OAAO"}
1
+ {"version":3,"file":"filesink.node.d.cts","names":[],"sources":["../src/filesink.node.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAsBA;AAwBa,cAxBA,UAqCZ,EArCwB,sBAwBK,CAAA,MAA2B,GAAA,IAAA,CAAA;AAmBzD;AAYA;AAqBA;;AAEY,cAtDC,eAsDD,EAtDkB,2BAsDlB,CAAA,MAAA,GAAA,IAAA,CAAA;;;AACQ;AACpB;AAA2B,cArCd,cAqCc,EArCE,0BAqCF,CAAA,MAAA,GAAA,IAAA,CAAA;;;;AAGF;AA2BT,cAvDH,mBAuDsB,EAvDD,+BAuDC,CAAA,MAAA,GAAA,IAAA,CAAA;;;;;AAGf;AACpB;;;;;AAGyB;AA0BT,iBAnEA,WAAA,CAmEuB,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAjE3B,eAiE2B,CAAA,EAhEpC,IAgEoC,GAhE7B,UAgE6B;AAAA,iBA/DvB,WAAA,CA+DuB,IAAA,EAAA,MAAA,EAAA,OAAA,EA7D5B,eA6D4B,GAAA;EAAA,WAC5B,EAAA,IAAA;CAA2B,CAAA,EA7DnC,IA8DA,GA9DO,eA8DP;;AAAiB;AACpB;;;;;AAEyB;;;;;;;;;iBAtCT,mBAAA,yBAEJ,0BACT,OAAO;iBACM,mBAAA,wBAEL;;IACR,OAAO;;;;;;;;;;;;;;;;iBA0BM,uBAAA,UACL,8BACR,OAAO;iBACM,uBAAA,UACL;;IACR,OAAO"}
@@ -1,4 +1,5 @@
1
1
  import { AsyncRotatingFileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions } from "./filesink.base.js";
2
+ import { AsyncTimeRotatingFileSinkDriver, TimeRotatingFileSinkDriver, TimeRotatingFileSinkOptions } from "./timefilesink.js";
2
3
  import { Sink } from "@logtape/logtape";
3
4
 
4
5
  //#region src/filesink.node.d.ts
@@ -12,6 +13,16 @@ declare const nodeDriver: RotatingFileSinkDriver<number | void>;
12
13
  * @since 1.0.0
13
14
  */
14
15
  declare const nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void>;
16
+ /**
17
+ * A Node.js-specific time-rotating file sink driver.
18
+ * @since 1.4.0
19
+ */
20
+ declare const nodeTimeDriver: TimeRotatingFileSinkDriver<number | void>;
21
+ /**
22
+ * A Node.js-specific async time-rotating file sink driver.
23
+ * @since 1.4.0
24
+ */
25
+ declare const nodeAsyncTimeDriver: AsyncTimeRotatingFileSinkDriver<number | void>;
15
26
  /**
16
27
  * Get a file sink.
17
28
  *
@@ -47,7 +58,26 @@ declare function getRotatingFileSink(path: string, options?: RotatingFileSinkOpt
47
58
  declare function getRotatingFileSink(path: string, options: RotatingFileSinkOptions & {
48
59
  nonBlocking: true;
49
60
  }): Sink & AsyncDisposable;
61
+ /**
62
+ * Get a time-rotating file sink.
63
+ *
64
+ * This sink writes log records to a file in a directory, rotating to a new
65
+ * file based on time intervals. The filename is generated based on the
66
+ * current date/time and the configured interval.
67
+ *
68
+ * Note that this function is unavailable in the browser.
69
+ *
70
+ * @param options The options for the sink.
71
+ * @returns A sink that writes to the file. The sink is also a disposable
72
+ * object that closes the file when disposed. If `nonBlocking` is
73
+ * enabled, returns a sink that also implements {@link AsyncDisposable}.
74
+ * @since 1.4.0
75
+ */
76
+ declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions): Sink & Disposable;
77
+ declare function getTimeRotatingFileSink(options: TimeRotatingFileSinkOptions & {
78
+ nonBlocking: true;
79
+ }): Sink & AsyncDisposable;
50
80
  //# sourceMappingURL=filesink.node.d.ts.map
51
81
  //#endregion
52
- export { getFileSink, getRotatingFileSink, nodeAsyncDriver, nodeDriver };
82
+ export { getFileSink, getRotatingFileSink, getTimeRotatingFileSink, nodeAsyncDriver, nodeAsyncTimeDriver, nodeDriver, nodeTimeDriver };
53
83
  //# sourceMappingURL=filesink.node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filesink.node.d.ts","names":[],"sources":["../src/filesink.node.ts"],"sourcesContent":[],"mappings":";;;;;;;AAeA;AAwBa,cAxBA,UAqCZ,EArCwB,sBAwBK,CAAA,MAA2B,GAAA,IAAA,CAAA;AA0BzD;;;;AAGU,cA7BG,eA6BH,EA7BoB,2BA6BpB,CAAA,MAAA,GAAA,IAAA,CAAA;AAAU;AACpB;;;;;AAGyB;AA2BzB;;;;AAGU,iBArCM,WAAA,CAqCN,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAnCE,eAmCF,CAAA,EAlCP,IAkCO,GAlCA,UAkCA;AAAU,iBAjCJ,WAAA,CAiCI,IAAA,EAAA,MAAA,EAAA,OAAA,EA/BT,eA+BS,GAAA;EACJ,WAAA,EAAA,IAAA;CAAmB,CAAA,EA/BhC,IA+BgC,GA/BzB,eA+ByB;;;;AAGV;;;;;;;;;;;;;iBAPT,mBAAA,yBAEJ,0BACT,OAAO;iBACM,mBAAA,wBAEL;;IACR,OAAO"}
1
+ {"version":3,"file":"filesink.node.d.ts","names":[],"sources":["../src/filesink.node.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAsBA;AAwBa,cAxBA,UAqCZ,EArCwB,sBAwBK,CAAA,MAA2B,GAAA,IAAA,CAAA;AAmBzD;AAYA;AAqBA;;AAEY,cAtDC,eAsDD,EAtDkB,2BAsDlB,CAAA,MAAA,GAAA,IAAA,CAAA;;;AACQ;AACpB;AAA2B,cArCd,cAqCc,EArCE,0BAqCF,CAAA,MAAA,GAAA,IAAA,CAAA;;;;AAGF;AA2BT,cAvDH,mBAuDsB,EAvDD,+BAuDC,CAAA,MAAA,GAAA,IAAA,CAAA;;;;;AAGf;AACpB;;;;;AAGyB;AA0BT,iBAnEA,WAAA,CAmEuB,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAjE3B,eAiE2B,CAAA,EAhEpC,IAgEoC,GAhE7B,UAgE6B;AAAA,iBA/DvB,WAAA,CA+DuB,IAAA,EAAA,MAAA,EAAA,OAAA,EA7D5B,eA6D4B,GAAA;EAAA,WAC5B,EAAA,IAAA;CAA2B,CAAA,EA7DnC,IA8DA,GA9DO,eA8DP;;AAAiB;AACpB;;;;;AAEyB;;;;;;;;;iBAtCT,mBAAA,yBAEJ,0BACT,OAAO;iBACM,mBAAA,wBAEL;;IACR,OAAO;;;;;;;;;;;;;;;;iBA0BM,uBAAA,UACL,8BACR,OAAO;iBACM,uBAAA,UACL;;IACR,OAAO"}
@@ -1,5 +1,7 @@
1
1
  import { getBaseFileSink, getBaseRotatingFileSink } from "./filesink.base.js";
2
+ import { getBaseTimeRotatingFileSink } from "./timefilesink.js";
2
3
  import fs from "node:fs";
4
+ import { join } from "node:path";
3
5
  import { promisify } from "node:util";
4
6
 
5
7
  //#region src/filesink.node.ts
@@ -41,6 +43,28 @@ const nodeAsyncDriver = {
41
43
  flush: promisify(fs.fsync),
42
44
  close: promisify(fs.close)
43
45
  };
46
+ /**
47
+ * A Node.js-specific time-rotating file sink driver.
48
+ * @since 1.4.0
49
+ */
50
+ const nodeTimeDriver = {
51
+ ...nodeDriver,
52
+ readdirSync: fs.readdirSync,
53
+ unlinkSync: fs.unlinkSync,
54
+ mkdirSync: fs.mkdirSync,
55
+ joinPath: join
56
+ };
57
+ /**
58
+ * A Node.js-specific async time-rotating file sink driver.
59
+ * @since 1.4.0
60
+ */
61
+ const nodeAsyncTimeDriver = {
62
+ ...nodeAsyncDriver,
63
+ readdirSync: fs.readdirSync,
64
+ unlinkSync: fs.unlinkSync,
65
+ mkdirSync: fs.mkdirSync,
66
+ joinPath: join
67
+ };
44
68
  function getFileSink(path, options = {}) {
45
69
  if (options.nonBlocking) return getBaseFileSink(path, {
46
70
  ...options,
@@ -61,7 +85,17 @@ function getRotatingFileSink(path, options = {}) {
61
85
  ...nodeDriver
62
86
  });
63
87
  }
88
+ function getTimeRotatingFileSink(options) {
89
+ if (options.nonBlocking) return getBaseTimeRotatingFileSink({
90
+ ...options,
91
+ ...nodeAsyncTimeDriver
92
+ });
93
+ return getBaseTimeRotatingFileSink({
94
+ ...options,
95
+ ...nodeTimeDriver
96
+ });
97
+ }
64
98
 
65
99
  //#endregion
66
- export { getFileSink, getRotatingFileSink, nodeAsyncDriver, nodeDriver };
100
+ export { getFileSink, getRotatingFileSink, getTimeRotatingFileSink, nodeAsyncDriver, nodeAsyncTimeDriver, nodeDriver, nodeTimeDriver };
67
101
  //# sourceMappingURL=filesink.node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filesink.node.js","names":["nodeDriver: RotatingFileSinkDriver<number | void>","path: string","fd: number","chunks: Uint8Array[]","nodeAsyncDriver: AsyncRotatingFileSinkDriver<number | void>","options: FileSinkOptions","options: RotatingFileSinkOptions"],"sources":["../src/filesink.node.ts"],"sourcesContent":["import type { Sink } from \"@logtape/logtape\";\nimport fs from \"node:fs\";\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\";\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 * 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// cSpell: ignore filesink\n"],"mappings":";;;;;;;;AAeA,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,GAAG;AACvB,MAAG,UAAU,IAAI,OAAO,GAAG;AAC3B;EACD;AAED,KAAG,WAAW,IAAI,OAAO;CAC1B;CACD,WAAW,GAAG;CACd,WAAW,GAAG;CACd,UAAU,GAAG;CACb,YAAY,GAAG;AAChB;;;;;AAMD,MAAaC,kBAA8D;CACzE,GAAG;CACH,MAAM,UAAUF,IAAYC,QAAqC;AAC/D,MAAI,OAAO,WAAW,EAAG;AACzB,MAAI,OAAO,WAAW,GAAG;AACvB,SAAM,UAAU,GAAG,MAAM,CAAC,IAAI,OAAO,GAAG;AACxC;EACD;AAED,QAAM,UAAU,GAAG,OAAO,CAAC,IAAI,OAAO;CACvC;CACD,OAAO,UAAU,GAAG,MAAM;CAC1B,OAAO,UAAU,GAAG,MAAM;AAC3B;AAqBD,SAAgB,YACdF,MACAI,UAA2B,CAAE,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,oBACdJ,MACAK,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"}
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,IAAYC,QAA4B;AACpD,MAAI,OAAO,WAAW,EAAG;AACzB,MAAI,OAAO,WAAW,GAAG;AACvB,MAAG,UAAU,IAAI,OAAO,GAAG;AAC3B;EACD;AAED,KAAG,WAAW,IAAI,OAAO;CAC1B;CACD,WAAW,GAAG;CACd,WAAW,GAAG;CACd,UAAU,GAAG;CACb,YAAY,GAAG;AAChB;;;;;AAMD,MAAaC,kBAA8D;CACzE,GAAG;CACH,MAAM,UAAUF,IAAYC,QAAqC;AAC/D,MAAI,OAAO,WAAW,EAAG;AACzB,MAAI,OAAO,WAAW,GAAG;AACvB,SAAM,UAAU,GAAG,MAAM,CAAC,IAAI,OAAO,GAAG;AACxC;EACD;AAED,QAAM,UAAU,GAAG,OAAO,CAAC,IAAI,OAAO;CACvC;CACD,OAAO,UAAU,GAAG,MAAM;CAC1B,OAAO,UAAU,GAAG,MAAM;AAC3B;;;;;AAMD,MAAaE,iBAA4D;CACvE,GAAG;CACH,aAAa,GAAG;CAChB,YAAY,GAAG;CACf,WAAW,GAAG;CACd,UAAU;AACX;;;;;AAMD,MAAaC,sBAET;CACF,GAAG;CACH,aAAa,GAAG;CAChB,YAAY,GAAG;CACf,WAAW,GAAG;CACd,UAAU;AACX;AAqBD,SAAgB,YACdL,MACAM,UAA2B,CAAE,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,oBACdN,MACAO,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"}
package/dist/mod.cjs CHANGED
@@ -14,4 +14,10 @@ Object.defineProperty(exports, 'getRotatingFileSink', {
14
14
  return __filesink.getRotatingFileSink;
15
15
  }
16
16
  });
17
- exports.getStreamFileSink = require_streamfilesink.getStreamFileSink;
17
+ exports.getStreamFileSink = require_streamfilesink.getStreamFileSink;
18
+ Object.defineProperty(exports, 'getTimeRotatingFileSink', {
19
+ enumerable: true,
20
+ get: function () {
21
+ return __filesink.getTimeRotatingFileSink;
22
+ }
23
+ });
package/dist/mod.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions } from "./filesink.base.cjs";
2
+ import { TimeRotatingFileSinkOptions, TimeRotationInterval } from "./timefilesink.cjs";
2
3
  import { StreamFileSinkOptions, getStreamFileSink } from "./streamfilesink.cjs";
3
- import { getFileSink, getRotatingFileSink } from "#filesink";
4
- export { FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions, StreamFileSinkOptions, getFileSink, getRotatingFileSink, getStreamFileSink };
4
+ import { getFileSink, getRotatingFileSink, getTimeRotatingFileSink } from "#filesink";
5
+ export { FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions, StreamFileSinkOptions, TimeRotatingFileSinkOptions, TimeRotationInterval, getFileSink, getRotatingFileSink, getStreamFileSink, getTimeRotatingFileSink };
package/dist/mod.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions } from "./filesink.base.js";
2
+ import { TimeRotatingFileSinkOptions, TimeRotationInterval } from "./timefilesink.js";
2
3
  import { StreamFileSinkOptions, getStreamFileSink } from "./streamfilesink.js";
3
- import { getFileSink, getRotatingFileSink } from "#filesink";
4
- export { FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions, StreamFileSinkOptions, getFileSink, getRotatingFileSink, getStreamFileSink };
4
+ import { getFileSink, getRotatingFileSink, getTimeRotatingFileSink } from "#filesink";
5
+ export { FileSinkDriver, FileSinkOptions, RotatingFileSinkDriver, RotatingFileSinkOptions, StreamFileSinkOptions, TimeRotatingFileSinkOptions, TimeRotationInterval, getFileSink, getRotatingFileSink, getStreamFileSink, getTimeRotatingFileSink };
package/dist/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { getStreamFileSink } from "./streamfilesink.js";
2
- import { getFileSink, getRotatingFileSink } from "#filesink";
2
+ import { getFileSink, getRotatingFileSink, getTimeRotatingFileSink } from "#filesink";
3
3
 
4
- export { getFileSink, getRotatingFileSink, getStreamFileSink };
4
+ export { getFileSink, getRotatingFileSink, getStreamFileSink, getTimeRotatingFileSink };
@@ -0,0 +1,8 @@
1
+
2
+ //#region ../../node_modules/.pnpm/@jsr+std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.js
3
+ function assertPath(path) {
4
+ if (typeof path !== "string") throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
5
+ }
6
+
7
+ //#endregion
8
+ exports.assertPath = assertPath;
@@ -0,0 +1,8 @@
1
+ //#region ../../node_modules/.pnpm/@jsr+std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.js
2
+ function assertPath(path) {
3
+ if (typeof path !== "string") throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
4
+ }
5
+
6
+ //#endregion
7
+ export { assertPath };
8
+ //# sourceMappingURL=assert_path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert_path.js","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@jsr+std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.js"],"sourcesContent":["// Copyright 2018-2025 the Deno authors. MIT license.\n// Copyright the Browserify authors. MIT License.\nexport function assertPath(path) {\n if (typeof path !== \"string\") {\n throw new TypeError(`Path must be a string, received \"${JSON.stringify(path)}\"`);\n }\n}\n//# sourceMappingURL=assert_path.js.map"],"x_google_ignoreList":[0],"mappings":";AAEA,SAAgB,WAAW,MAAM;AAC/B,YAAW,SAAS,SAClB,OAAM,IAAI,WAAW,mCAAmC,KAAK,UAAU,KAAK,CAAC;AAEhF"}