@restroom-mw/logger
Advanced tools
Comparing version 0.13.1-514f76b.75 to 0.13.1-69dae1d.83
@@ -18,2 +18,3 @@ "use strict"; | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
const utils_1 = require("@restroom-mw/utils"); | ||
@@ -34,4 +35,5 @@ require("dotenv").config(); | ||
const addLog = (sentences, where) => { | ||
validatePath(where); | ||
const ws = fs_1.default.createWriteStream(where, { flags: "a" }); | ||
const absolutePath = path_1.default.resolve(path_1.default.join(exports.LOGGER_DIR, where)); | ||
validatePath(absolutePath); | ||
const ws = fs_1.default.createWriteStream(absolutePath, { flags: "a" }); | ||
ws.on('error', (error) => { | ||
@@ -45,3 +47,3 @@ throw new Error(`[LOGGER] An error occurred while writing to ${where}\n${error}`); | ||
for (const [sentence, where] of params) { | ||
addLog([input[sentence] || sentence], where); | ||
addLog([result[sentence] || input[sentence] || sentence], where); | ||
} | ||
@@ -56,3 +58,3 @@ } | ||
} | ||
addLog([input[sentence] || sentence], logPath); | ||
addLog([result[sentence] || input[sentence] || sentence], logPath); | ||
} | ||
@@ -59,0 +61,0 @@ } |
{ | ||
"name": "@restroom-mw/logger", | ||
"version": "0.13.1-514f76b.75+514f76b", | ||
"version": "0.13.1-69dae1d.83+69dae1d", | ||
"description": "Utilities middleware to work with files for Restroom", | ||
@@ -36,3 +36,3 @@ "author": "Alberto Lerda <alberto@dyne.org>", | ||
}, | ||
"gitHead": "514f76baa214524ecfa09722b8a823026813ba17" | ||
"gitHead": "69dae1df2b90346c016aadea221fdd63d86ba2fb" | ||
} |
@@ -28,4 +28,5 @@ import {Restroom} from "@restroom-mw/core"; | ||
const addLog = (sentences: string[], where: string) => { | ||
validatePath(where); | ||
const ws = fs.createWriteStream(where, {flags: "a"}); | ||
const absolutePath = path.resolve(path.join(LOGGER_DIR, where)); | ||
validatePath(absolutePath); | ||
const ws = fs.createWriteStream(absolutePath, {flags: "a"}); | ||
ws.on('error', (error) => { | ||
@@ -41,3 +42,3 @@ throw new Error( | ||
for(const [ sentence, where ] of params) { | ||
addLog([ input[sentence] || sentence ], where); | ||
addLog([ result[sentence] || input[sentence] || sentence ], where); | ||
} | ||
@@ -53,3 +54,3 @@ } | ||
} | ||
addLog([ input[sentence] || sentence ], logPath); | ||
addLog([ result[sentence] || input[sentence] || sentence ], logPath); | ||
} | ||
@@ -56,0 +57,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
43101
147