cositas
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user