This commit is contained in:
2026-01-24 14:49:36 -03:00
parent 275a7600a3
commit b95800c05f
3 changed files with 67 additions and 7 deletions

View File

@@ -1,15 +1,11 @@
import { appendFileSync, existsSync } from 'fs';
import { createWriteStream } from 'fs';
const filename = 'logs.csv',
exist = existsSync(filename);
fileExist = existsSync(filename);
console.log(filename, exist);
console.log(filename, fileExist);
if (!exist) {
appendFileSync(filename, ['Date', 'Method', 'Url', 'Status'].join(',') + '\n', 'utf8');
}
if (!fileExist) appendFileSync(filename, ['Date', 'Method', 'Url', 'Status'].join(',') + '\n', 'utf8');
export const log = (method: string, url: string, status: number) => {
appendFileSync(filename, [isoDateInTimeZone(), method, url, status].join(',') + '\n', 'utf8');