@logtape/file 1.4.0-dev.444 → 1.4.0-dev.446
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.
- package/dist/filesink.base.d.cts +1 -1
- package/dist/filesink.base.d.ts +1 -1
- package/dist/filesink.deno.cjs +46 -1
- package/dist/filesink.deno.d.cts +31 -1
- package/dist/filesink.deno.d.cts.map +1 -1
- package/dist/filesink.deno.d.ts +31 -1
- package/dist/filesink.deno.d.ts.map +1 -1
- package/dist/filesink.deno.js +43 -1
- package/dist/filesink.deno.js.map +1 -1
- package/dist/filesink.node.cjs +38 -1
- package/dist/filesink.node.d.cts +31 -1
- package/dist/filesink.node.d.cts.map +1 -1
- package/dist/filesink.node.d.ts +31 -1
- package/dist/filesink.node.d.ts.map +1 -1
- package/dist/filesink.node.js +35 -1
- package/dist/filesink.node.js.map +1 -1
- package/dist/mod.cjs +7 -1
- package/dist/mod.d.cts +3 -2
- package/dist/mod.d.ts +3 -2
- package/dist/mod.js +2 -2
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.cjs +8 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.js +8 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/assert_path.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/constants.cjs +20 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/constants.js +13 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/constants.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/from_file_url.cjs +10 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/from_file_url.js +10 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/from_file_url.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize.cjs +10 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize.js +11 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize_string.cjs +56 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize_string.js +57 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_common/normalize_string.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_os.cjs +6 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_os.js +6 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/_os.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/join.cjs +31 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/join.js +32 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/join.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/_util.cjs +9 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/_util.js +10 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/_util.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/from_file_url.cjs +23 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/from_file_url.js +24 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/from_file_url.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/join.cjs +44 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/join.js +45 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/join.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/normalize.cjs +54 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/normalize.js +55 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/posix/normalize.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/_util.cjs +13 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/_util.js +13 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/_util.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/from_file_url.cjs +27 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/from_file_url.js +28 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/from_file_url.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/join.cjs +51 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/join.js +52 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/join.js.map +1 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/normalize.cjs +82 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/normalize.js +83 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.1.0/node_modules/@jsr/std__path/windows/normalize.js.map +1 -0
- package/dist/timefilesink.cjs +208 -0
- package/dist/timefilesink.d.cts +104 -0
- package/dist/timefilesink.d.cts.map +1 -0
- package/dist/timefilesink.d.ts +104 -0
- package/dist/timefilesink.d.ts.map +1 -0
- package/dist/timefilesink.js +208 -0
- package/dist/timefilesink.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { AsyncFileSinkDriver, FileSinkDriver, FileSinkOptions } from "./filesink.base.cjs";
|
|
2
|
+
import { Sink } from "@logtape/logtape";
|
|
3
|
+
|
|
4
|
+
//#region src/timefilesink.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The rotation interval for time-based file sinks.
|
|
8
|
+
*/
|
|
9
|
+
type TimeRotationInterval = "hourly" | "daily" | "weekly";
|
|
10
|
+
/**
|
|
11
|
+
* Options for the {@link getBaseTimeRotatingFileSink} function.
|
|
12
|
+
*/
|
|
13
|
+
interface TimeRotatingFileSinkOptions extends Omit<FileSinkOptions, "lazy"> {
|
|
14
|
+
/**
|
|
15
|
+
* The directory to write log files to.
|
|
16
|
+
*/
|
|
17
|
+
directory: string;
|
|
18
|
+
/**
|
|
19
|
+
* A function that generates the filename for the log file based on the date.
|
|
20
|
+
* Default depends on `interval`:
|
|
21
|
+
* - `"daily"`: `YYYY-MM-DD.log` (e.g., `2025-01-15.log`)
|
|
22
|
+
* - `"hourly"`: `YYYY-MM-DD-HH.log` (e.g., `2025-01-15-09.log`)
|
|
23
|
+
* - `"weekly"`: `YYYY-WW.log` (e.g., `2025-W03.log`)
|
|
24
|
+
*/
|
|
25
|
+
filename?: (date: Date) => string;
|
|
26
|
+
/**
|
|
27
|
+
* The rotation interval. Defaults to `"daily"`.
|
|
28
|
+
*/
|
|
29
|
+
interval?: TimeRotationInterval;
|
|
30
|
+
/**
|
|
31
|
+
* The maximum age of log files in milliseconds. Files older than this
|
|
32
|
+
* will be deleted. If not specified, old files are not deleted.
|
|
33
|
+
*/
|
|
34
|
+
maxAgeMs?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A platform-specific time-rotating file sink driver.
|
|
38
|
+
*/
|
|
39
|
+
interface TimeRotatingFileSinkDriver<TFile> extends FileSinkDriver<TFile> {
|
|
40
|
+
/**
|
|
41
|
+
* Read the contents of a directory.
|
|
42
|
+
* @param path A path to the directory.
|
|
43
|
+
* @returns An array of filenames in the directory.
|
|
44
|
+
*/
|
|
45
|
+
readdirSync(path: string): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Delete a file.
|
|
48
|
+
* @param path A path to the file to delete.
|
|
49
|
+
*/
|
|
50
|
+
unlinkSync(path: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Create a directory if it doesn't exist.
|
|
53
|
+
* @param path A path to the directory to create.
|
|
54
|
+
* @param options Options for directory creation.
|
|
55
|
+
*/
|
|
56
|
+
mkdirSync(path: string, options?: {
|
|
57
|
+
recursive?: boolean;
|
|
58
|
+
}): void;
|
|
59
|
+
/**
|
|
60
|
+
* Join path segments.
|
|
61
|
+
* @param paths Path segments to join.
|
|
62
|
+
* @returns The joined path.
|
|
63
|
+
*/
|
|
64
|
+
joinPath(...paths: string[]): string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A platform-specific async time-rotating file sink driver.
|
|
68
|
+
* @since 1.4.0
|
|
69
|
+
*/
|
|
70
|
+
interface AsyncTimeRotatingFileSinkDriver<TFile> extends AsyncFileSinkDriver<TFile> {
|
|
71
|
+
/**
|
|
72
|
+
* Read the contents of a directory.
|
|
73
|
+
* @param path A path to the directory.
|
|
74
|
+
* @returns An array of filenames in the directory.
|
|
75
|
+
*/
|
|
76
|
+
readdirSync(path: string): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Delete a file.
|
|
79
|
+
* @param path A path to the file to delete.
|
|
80
|
+
*/
|
|
81
|
+
unlinkSync(path: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Create a directory if it doesn't exist.
|
|
84
|
+
* @param path A path to the directory to create.
|
|
85
|
+
* @param options Options for directory creation.
|
|
86
|
+
*/
|
|
87
|
+
mkdirSync(path: string, options?: {
|
|
88
|
+
recursive?: boolean;
|
|
89
|
+
}): void;
|
|
90
|
+
/**
|
|
91
|
+
* Join path segments.
|
|
92
|
+
* @param paths Path segments to join.
|
|
93
|
+
* @returns The joined path.
|
|
94
|
+
*/
|
|
95
|
+
joinPath(...paths: string[]): string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get the ISO week number of a date.
|
|
99
|
+
* @param date The date to get the week number of.
|
|
100
|
+
* @returns The ISO week number (1-53).
|
|
101
|
+
*/
|
|
102
|
+
//#endregion
|
|
103
|
+
export { AsyncTimeRotatingFileSinkDriver, TimeRotatingFileSinkDriver, TimeRotatingFileSinkOptions, TimeRotationInterval };
|
|
104
|
+
//# sourceMappingURL=timefilesink.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timefilesink.d.cts","names":[],"sources":["../src/timefilesink.ts"],"sourcesContent":[],"mappings":";;;;;;;AAcA;AAKiB,KALL,oBAAA,GAMV,QAAA,GAAA,OAAA,GAAA,QAAA;;;;AAkBW,UAnBI,2BAAA,SACP,IAkBG,CAlBE,eAkBF,EAAA,MAAA,CAAA,CAAA;EAAoB;AAlBnB;AA8Bd;EAA2C,SAAA,EAAA,MAAA;EAAA;;AACnB;AAiCxB;;;;EAC6B,QAAA,CAAA,EAAA,CAAA,IAAA,EApDT,IAoDS,EAAA,GAAA,MAAA;;;;aA/ChB;;;;;;;;;;UAYI,0CACP,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiCR,+CACP,oBAAoB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { AsyncFileSinkDriver, FileSinkDriver, FileSinkOptions } from "./filesink.base.js";
|
|
2
|
+
import { Sink } from "@logtape/logtape";
|
|
3
|
+
|
|
4
|
+
//#region src/timefilesink.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The rotation interval for time-based file sinks.
|
|
8
|
+
*/
|
|
9
|
+
type TimeRotationInterval = "hourly" | "daily" | "weekly";
|
|
10
|
+
/**
|
|
11
|
+
* Options for the {@link getBaseTimeRotatingFileSink} function.
|
|
12
|
+
*/
|
|
13
|
+
interface TimeRotatingFileSinkOptions extends Omit<FileSinkOptions, "lazy"> {
|
|
14
|
+
/**
|
|
15
|
+
* The directory to write log files to.
|
|
16
|
+
*/
|
|
17
|
+
directory: string;
|
|
18
|
+
/**
|
|
19
|
+
* A function that generates the filename for the log file based on the date.
|
|
20
|
+
* Default depends on `interval`:
|
|
21
|
+
* - `"daily"`: `YYYY-MM-DD.log` (e.g., `2025-01-15.log`)
|
|
22
|
+
* - `"hourly"`: `YYYY-MM-DD-HH.log` (e.g., `2025-01-15-09.log`)
|
|
23
|
+
* - `"weekly"`: `YYYY-WW.log` (e.g., `2025-W03.log`)
|
|
24
|
+
*/
|
|
25
|
+
filename?: (date: Date) => string;
|
|
26
|
+
/**
|
|
27
|
+
* The rotation interval. Defaults to `"daily"`.
|
|
28
|
+
*/
|
|
29
|
+
interval?: TimeRotationInterval;
|
|
30
|
+
/**
|
|
31
|
+
* The maximum age of log files in milliseconds. Files older than this
|
|
32
|
+
* will be deleted. If not specified, old files are not deleted.
|
|
33
|
+
*/
|
|
34
|
+
maxAgeMs?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A platform-specific time-rotating file sink driver.
|
|
38
|
+
*/
|
|
39
|
+
interface TimeRotatingFileSinkDriver<TFile> extends FileSinkDriver<TFile> {
|
|
40
|
+
/**
|
|
41
|
+
* Read the contents of a directory.
|
|
42
|
+
* @param path A path to the directory.
|
|
43
|
+
* @returns An array of filenames in the directory.
|
|
44
|
+
*/
|
|
45
|
+
readdirSync(path: string): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Delete a file.
|
|
48
|
+
* @param path A path to the file to delete.
|
|
49
|
+
*/
|
|
50
|
+
unlinkSync(path: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Create a directory if it doesn't exist.
|
|
53
|
+
* @param path A path to the directory to create.
|
|
54
|
+
* @param options Options for directory creation.
|
|
55
|
+
*/
|
|
56
|
+
mkdirSync(path: string, options?: {
|
|
57
|
+
recursive?: boolean;
|
|
58
|
+
}): void;
|
|
59
|
+
/**
|
|
60
|
+
* Join path segments.
|
|
61
|
+
* @param paths Path segments to join.
|
|
62
|
+
* @returns The joined path.
|
|
63
|
+
*/
|
|
64
|
+
joinPath(...paths: string[]): string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A platform-specific async time-rotating file sink driver.
|
|
68
|
+
* @since 1.4.0
|
|
69
|
+
*/
|
|
70
|
+
interface AsyncTimeRotatingFileSinkDriver<TFile> extends AsyncFileSinkDriver<TFile> {
|
|
71
|
+
/**
|
|
72
|
+
* Read the contents of a directory.
|
|
73
|
+
* @param path A path to the directory.
|
|
74
|
+
* @returns An array of filenames in the directory.
|
|
75
|
+
*/
|
|
76
|
+
readdirSync(path: string): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Delete a file.
|
|
79
|
+
* @param path A path to the file to delete.
|
|
80
|
+
*/
|
|
81
|
+
unlinkSync(path: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Create a directory if it doesn't exist.
|
|
84
|
+
* @param path A path to the directory to create.
|
|
85
|
+
* @param options Options for directory creation.
|
|
86
|
+
*/
|
|
87
|
+
mkdirSync(path: string, options?: {
|
|
88
|
+
recursive?: boolean;
|
|
89
|
+
}): void;
|
|
90
|
+
/**
|
|
91
|
+
* Join path segments.
|
|
92
|
+
* @param paths Path segments to join.
|
|
93
|
+
* @returns The joined path.
|
|
94
|
+
*/
|
|
95
|
+
joinPath(...paths: string[]): string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get the ISO week number of a date.
|
|
99
|
+
* @param date The date to get the week number of.
|
|
100
|
+
* @returns The ISO week number (1-53).
|
|
101
|
+
*/
|
|
102
|
+
//#endregion
|
|
103
|
+
export { AsyncTimeRotatingFileSinkDriver, TimeRotatingFileSinkDriver, TimeRotatingFileSinkOptions, TimeRotationInterval };
|
|
104
|
+
//# sourceMappingURL=timefilesink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timefilesink.d.ts","names":[],"sources":["../src/timefilesink.ts"],"sourcesContent":[],"mappings":";;;;;;;AAcA;AAKiB,KALL,oBAAA,GAMV,QAAA,GAAA,OAAA,GAAA,QAAA;;;;AAkBW,UAnBI,2BAAA,SACP,IAkBG,CAlBE,eAkBF,EAAA,MAAA,CAAA,CAAA;EAAoB;AAlBnB;AA8Bd;EAA2C,SAAA,EAAA,MAAA;EAAA;;AACnB;AAiCxB;;;;EAC6B,QAAA,CAAA,EAAA,CAAA,IAAA,EApDT,IAoDS,EAAA,GAAA,MAAA;;;;aA/ChB;;;;;;;;;;UAYI,0CACP,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiCR,+CACP,oBAAoB"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { defaultTextFormatter } from "@logtape/logtape";
|
|
2
|
+
|
|
3
|
+
//#region src/timefilesink.ts
|
|
4
|
+
/**
|
|
5
|
+
* Get the ISO week number of a date.
|
|
6
|
+
* @param date The date to get the week number of.
|
|
7
|
+
* @returns The ISO week number (1-53).
|
|
8
|
+
*/
|
|
9
|
+
function getISOWeek(date) {
|
|
10
|
+
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
11
|
+
const dayNum = d.getUTCDay() || 7;
|
|
12
|
+
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
|
|
13
|
+
const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
|
|
14
|
+
return Math.ceil(((d.getTime() - yearStart.getTime()) / 864e5 + 1) / 7);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the ISO week year of a date. This may differ from the calendar year
|
|
18
|
+
* for dates near the start or end of a year.
|
|
19
|
+
* @param date The date to get the ISO week year of.
|
|
20
|
+
* @returns The ISO week year.
|
|
21
|
+
*/
|
|
22
|
+
function getISOWeekYear(date) {
|
|
23
|
+
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
24
|
+
const dayNum = d.getUTCDay() || 7;
|
|
25
|
+
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
|
|
26
|
+
return d.getUTCFullYear();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the default filename generator for the given interval.
|
|
30
|
+
* @param interval The rotation interval.
|
|
31
|
+
* @returns A function that generates a filename for a given date.
|
|
32
|
+
*/
|
|
33
|
+
function getDefaultFilename(interval) {
|
|
34
|
+
switch (interval) {
|
|
35
|
+
case "hourly": return (date) => {
|
|
36
|
+
const yyyy = date.getFullYear();
|
|
37
|
+
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
38
|
+
const dd = String(date.getDate()).padStart(2, "0");
|
|
39
|
+
const hh = String(date.getHours()).padStart(2, "0");
|
|
40
|
+
return `${yyyy}-${mm}-${dd}-${hh}.log`;
|
|
41
|
+
};
|
|
42
|
+
case "daily": return (date) => {
|
|
43
|
+
const yyyy = date.getFullYear();
|
|
44
|
+
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
45
|
+
const dd = String(date.getDate()).padStart(2, "0");
|
|
46
|
+
return `${yyyy}-${mm}-${dd}.log`;
|
|
47
|
+
};
|
|
48
|
+
case "weekly": return (date) => {
|
|
49
|
+
const yyyy = getISOWeekYear(date);
|
|
50
|
+
const week = getISOWeek(date);
|
|
51
|
+
return `${yyyy}-W${String(week).padStart(2, "0")}.log`;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get the rotation key for the given date and interval.
|
|
57
|
+
* The key is used to determine when to rotate to a new file.
|
|
58
|
+
* @param date The date to get the rotation key of.
|
|
59
|
+
* @param interval The rotation interval.
|
|
60
|
+
* @returns A string key that changes when rotation should occur.
|
|
61
|
+
*/
|
|
62
|
+
function getRotationKey(date, interval) {
|
|
63
|
+
switch (interval) {
|
|
64
|
+
case "hourly": return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getHours()}`;
|
|
65
|
+
case "daily": return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
|
|
66
|
+
case "weekly": return `${getISOWeekYear(date)}-${getISOWeek(date)}`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function getBaseTimeRotatingFileSink(options) {
|
|
70
|
+
const formatter = options.formatter ?? defaultTextFormatter;
|
|
71
|
+
const encoder = options.encoder ?? new TextEncoder();
|
|
72
|
+
const interval = options.interval ?? "daily";
|
|
73
|
+
const filenameGenerator = options.filename ?? getDefaultFilename(interval);
|
|
74
|
+
const maxAgeMs = options.maxAgeMs;
|
|
75
|
+
const bufferSize = options.bufferSize ?? 1024 * 8;
|
|
76
|
+
const flushInterval = options.flushInterval ?? 5e3;
|
|
77
|
+
const directory = options.directory;
|
|
78
|
+
try {
|
|
79
|
+
options.mkdirSync(directory, { recursive: true });
|
|
80
|
+
} catch {}
|
|
81
|
+
let currentFilename = filenameGenerator(/* @__PURE__ */ new Date());
|
|
82
|
+
let currentPath = options.joinPath(directory, currentFilename);
|
|
83
|
+
let currentRotationKey = getRotationKey(/* @__PURE__ */ new Date(), interval);
|
|
84
|
+
let fd = options.openSync(currentPath);
|
|
85
|
+
let lastFlushTimestamp = Date.now();
|
|
86
|
+
let buffer = "";
|
|
87
|
+
function shouldRotate() {
|
|
88
|
+
const now = /* @__PURE__ */ new Date();
|
|
89
|
+
const newKey = getRotationKey(now, interval);
|
|
90
|
+
return newKey !== currentRotationKey;
|
|
91
|
+
}
|
|
92
|
+
function performRotation() {
|
|
93
|
+
options.closeSync(fd);
|
|
94
|
+
const now = /* @__PURE__ */ new Date();
|
|
95
|
+
currentFilename = filenameGenerator(now);
|
|
96
|
+
currentPath = options.joinPath(directory, currentFilename);
|
|
97
|
+
currentRotationKey = getRotationKey(now, interval);
|
|
98
|
+
fd = options.openSync(currentPath);
|
|
99
|
+
}
|
|
100
|
+
function cleanupOldFiles() {
|
|
101
|
+
if (maxAgeMs === void 0) return;
|
|
102
|
+
const now = Date.now();
|
|
103
|
+
let files;
|
|
104
|
+
try {
|
|
105
|
+
files = options.readdirSync(directory);
|
|
106
|
+
} catch {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
for (const file of files) {
|
|
110
|
+
if (!file.endsWith(".log")) continue;
|
|
111
|
+
if (file === currentFilename) continue;
|
|
112
|
+
const filePath = options.joinPath(directory, file);
|
|
113
|
+
const dateMatch = file.match(/^(\d{4})-(\d{2})-(\d{2})(?:-(\d{2}))?\.log$/);
|
|
114
|
+
const weekMatch = file.match(/^(\d{4})-W(\d{2})\.log$/);
|
|
115
|
+
let fileDate = null;
|
|
116
|
+
if (dateMatch) {
|
|
117
|
+
const [, year, month, day, hour] = dateMatch;
|
|
118
|
+
fileDate = new Date(parseInt(year, 10), parseInt(month, 10) - 1, parseInt(day, 10), hour ? parseInt(hour, 10) : 0);
|
|
119
|
+
} else if (weekMatch) {
|
|
120
|
+
const [, year, week] = weekMatch;
|
|
121
|
+
const jan4 = new Date(parseInt(year, 10), 0, 4);
|
|
122
|
+
const dayOfWeek = jan4.getDay() || 7;
|
|
123
|
+
fileDate = new Date(jan4);
|
|
124
|
+
fileDate.setDate(jan4.getDate() - dayOfWeek + 1 + (parseInt(week, 10) - 1) * 7);
|
|
125
|
+
}
|
|
126
|
+
if (fileDate && now - fileDate.getTime() > maxAgeMs) try {
|
|
127
|
+
options.unlinkSync(filePath);
|
|
128
|
+
} catch {}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (!options.nonBlocking) {
|
|
132
|
+
function flushBuffer$1() {
|
|
133
|
+
if (buffer.length > 0) {
|
|
134
|
+
if (shouldRotate()) performRotation();
|
|
135
|
+
const bytes = encoder.encode(buffer);
|
|
136
|
+
buffer = "";
|
|
137
|
+
options.writeSync(fd, bytes);
|
|
138
|
+
options.flushSync(fd);
|
|
139
|
+
lastFlushTimestamp = Date.now();
|
|
140
|
+
cleanupOldFiles();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const sink = (record) => {
|
|
144
|
+
buffer += formatter(record);
|
|
145
|
+
const shouldFlushBySize = buffer.length >= bufferSize;
|
|
146
|
+
const shouldFlushByTime = flushInterval > 0 && record.timestamp - lastFlushTimestamp >= flushInterval;
|
|
147
|
+
if (shouldFlushBySize || shouldFlushByTime) flushBuffer$1();
|
|
148
|
+
};
|
|
149
|
+
sink[Symbol.dispose] = () => {
|
|
150
|
+
flushBuffer$1();
|
|
151
|
+
options.closeSync(fd);
|
|
152
|
+
};
|
|
153
|
+
return sink;
|
|
154
|
+
}
|
|
155
|
+
const asyncOptions = options;
|
|
156
|
+
let disposed = false;
|
|
157
|
+
let activeFlush = null;
|
|
158
|
+
let flushTimer = null;
|
|
159
|
+
async function flushBuffer() {
|
|
160
|
+
if (buffer.length === 0) return;
|
|
161
|
+
if (shouldRotate()) performRotation();
|
|
162
|
+
const data = buffer;
|
|
163
|
+
buffer = "";
|
|
164
|
+
try {
|
|
165
|
+
const bytes = encoder.encode(data);
|
|
166
|
+
asyncOptions.writeSync(fd, bytes);
|
|
167
|
+
await asyncOptions.flush(fd);
|
|
168
|
+
lastFlushTimestamp = Date.now();
|
|
169
|
+
cleanupOldFiles();
|
|
170
|
+
} catch {}
|
|
171
|
+
}
|
|
172
|
+
function scheduleFlush() {
|
|
173
|
+
if (activeFlush || disposed) return;
|
|
174
|
+
activeFlush = flushBuffer().finally(() => {
|
|
175
|
+
activeFlush = null;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function startFlushTimer() {
|
|
179
|
+
if (flushTimer !== null || disposed) return;
|
|
180
|
+
flushTimer = setInterval(() => {
|
|
181
|
+
scheduleFlush();
|
|
182
|
+
}, flushInterval);
|
|
183
|
+
}
|
|
184
|
+
const nonBlockingSink = (record) => {
|
|
185
|
+
if (disposed) return;
|
|
186
|
+
buffer += formatter(record);
|
|
187
|
+
const shouldFlushBySize = buffer.length >= bufferSize;
|
|
188
|
+
const shouldFlushByTime = flushInterval > 0 && record.timestamp - lastFlushTimestamp >= flushInterval;
|
|
189
|
+
if (shouldFlushBySize || shouldFlushByTime) scheduleFlush();
|
|
190
|
+
else if (flushTimer === null && flushInterval > 0) startFlushTimer();
|
|
191
|
+
};
|
|
192
|
+
nonBlockingSink[Symbol.asyncDispose] = async () => {
|
|
193
|
+
disposed = true;
|
|
194
|
+
if (flushTimer !== null) {
|
|
195
|
+
clearInterval(flushTimer);
|
|
196
|
+
flushTimer = null;
|
|
197
|
+
}
|
|
198
|
+
await flushBuffer();
|
|
199
|
+
try {
|
|
200
|
+
await asyncOptions.close(fd);
|
|
201
|
+
} catch {}
|
|
202
|
+
};
|
|
203
|
+
return nonBlockingSink;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//#endregion
|
|
207
|
+
export { getBaseTimeRotatingFileSink };
|
|
208
|
+
//# sourceMappingURL=timefilesink.js.map
|
|
@@ -0,0 +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 nonBlockingSink;\n}\n"],"mappings":";;;;;;;;AAuHA,SAAgB,WAAWA,MAAoB;CAC7C,MAAM,IAAI,IAAI,KACZ,KAAK,IAAI,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,CAAC;CAE/D,MAAM,SAAS,EAAE,WAAW,IAAI;AAChC,GAAE,WAAW,EAAE,YAAY,GAAG,IAAI,OAAO;CACzC,MAAM,YAAY,IAAI,KAAK,KAAK,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE;AAC7D,QAAO,KAAK,OAAO,EAAE,SAAS,GAAG,UAAU,SAAS,IAAI,QAAW,KAAK,EAAE;AAC3E;;;;;;;AAQD,SAAgB,eAAeA,MAAoB;CACjD,MAAM,IAAI,IAAI,KACZ,KAAK,IAAI,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,CAAC;CAE/D,MAAM,SAAS,EAAE,WAAW,IAAI;AAChC,GAAE,WAAW,EAAE,YAAY,GAAG,IAAI,OAAO;AACzC,QAAO,EAAE,gBAAgB;AAC1B;;;;;;AAOD,SAAgB,mBACdC,UACwB;AACxB,SAAQ,UAAR;EACE,KAAK,SACH,QAAO,C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;AAEzB,MAAI,cAAc,CAChB,kBAAiB;EAGnB,MAAM,OAAO;AACb,WAAS;AACT,MAAI;GACF,MAAM,QAAQ,QAAQ,OAAO,KAAK;AAClC,gBAAa,UAAU,IAAI,MAAM;AACjC,SAAM,aAAa,MAAM,GAAG;AAC5B,wBAAqB,KAAK,KAAK;AAC/B,oBAAiB;EAClB,QAAO,CAEP;CACF;CAED,SAAS,gBAAsB;AAC7B,MAAI,eAAe,SAAU;AAE7B,gBAAc,aAAa,CAAC,QAAQ,MAAM;AACxC,iBAAc;EACf,EAAC;CACH;CAED,SAAS,kBAAwB;AAC/B,MAAI,eAAe,QAAQ,SAAU;AAErC,eAAa,YAAY,MAAM;AAC7B,kBAAe;EAChB,GAAE,cAAc;CAClB;CAED,MAAMC,kBAA0C,CAACH,WAAsB;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logtape/file",
|
|
3
|
-
"version": "1.4.0-dev.
|
|
3
|
+
"version": "1.4.0-dev.446+9d8098ca",
|
|
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.
|
|
63
|
+
"@logtape/logtape": "^1.4.0-dev.446+9d8098ca"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@alinea/suite": "^0.6.3",
|