-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Task] #10 validating incoming parameter and logging errors
- Loading branch information
1 parent
3c5a6a2
commit 57fbd75
Showing
4 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// primitive text logger | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
const logPath = path.resolve(__dirname, '../httpdocs', 'log.txt'); | ||
const date = new Date().toLocaleString('de-DE', { hour12: false }); | ||
|
||
export default { | ||
log: (message:string|JSON) => { | ||
fs.appendFileSync(logPath, `${date} \t|\t ${message} \n`); | ||
console.log(message); | ||
|
||
} | ||
} |