Skip to content

Commit 49f1833

Browse files
committed
docs(changeset): Timestampt log files
1 parent 9ab9b71 commit 49f1833

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/full-moments-slide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"git-json-resolver": patch
3+
---
4+
5+
Timestampt log files

lib/src/logger.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ export const createLogger = (config: LoggerConfig = {}) => {
6767
const flush = () => {
6868
if (mode === "memory") {
6969
for (const [fileId, entries] of buffers.entries()) {
70-
const filePath = path.join(logDir, singleFile ? "combined.log" : `${fileId}.log`);
70+
const filePath = path.join(
71+
logDir,
72+
singleFile
73+
? `combined-${new Date().toISOString()}.log`
74+
: `${fileId}-${new Date().toISOString()}.log`,
75+
);
7176
const lines = entries.map(e => `[${e.timestamp}] [${e.level.toUpperCase()}] ${e.message}`);
7277
fs.writeFileSync(filePath, lines.join("\n") + "\n", { flag: "a" });
7378
}

0 commit comments

Comments
 (0)