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

2
logs.csv Normal file
View File

@@ -0,0 +1,2 @@
Date,Method,Url,Status
2026-01-24T14:38:27.286-3,GET,http://api.openweathermap.org/geo/1.0/direct?q=villa%20del%20parque&limit=1&appid=622bea1c2742e805c0f2c5fb49494bc9,200
1 Date Method Url Status
2 2026-01-24T14:38:27.286-3 GET http://api.openweathermap.org/geo/1.0/direct?q=villa%20del%20parque&limit=1&appid=622bea1c2742e805c0f2c5fb49494bc9 200

62
package-lock.json generated Normal file
View File

@@ -0,0 +1,62 @@
{
"name": "osito",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "osito",
"version": "1.0.0",
"license": "ISC",
"devDependencies": {
"@types/node": "^25.0.10",
"csv-parser": "^3.2.0",
"typescript": "^5.9.3"
}
},
"node_modules/@types/node": {
"version": "25.0.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.10.tgz",
"integrity": "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~7.16.0"
}
},
"node_modules/csv-parser": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.2.0.tgz",
"integrity": "sha512-fgKbp+AJbn1h2dcAHKIdKNSSjfp43BZZykXsCjzALjKy80VXQNHPFJ6T9Afwdzoj24aMkq8GwDS7KGcDPpejrA==",
"dev": true,
"license": "MIT",
"bin": {
"csv-parser": "bin/csv-parser"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/typescript": {
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/undici-types": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"dev": true,
"license": "MIT"
}
}
}

View File

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