-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor comment and clean code
- Loading branch information
Showing
5 changed files
with
61 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
export default (text) => { | ||
const date = new Date(new Date().toLocaleString('en-US', {timeZone: 'Asia/Jakarta'})); | ||
const currentDate = '[' + | ||
date.getDate() + '/' + | ||
(date.getMonth() + 1) + '/' + | ||
date.getHours() + ':' + | ||
date.getMinutes() + ':' + | ||
date.getSeconds() + | ||
']'; | ||
/** | ||
* Logs the given text along with the current date and process ID. | ||
* @param {string} text - The text to be logged. | ||
*/ | ||
export default function Logger(text) { | ||
if (typeof text !== 'string') { | ||
console.error('Error: text must be a string'); | ||
return; | ||
} | ||
|
||
console.log('\n' + currentDate + ' (' + process.pid + '): ' + text); | ||
const date = new Date().toLocaleString('en-US', { timeZone: 'Asia/Jakarta' }); | ||
console.log(`[${date}] (${process.pid}): ${text}`); | ||
} |
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