time added and var with let replaced

This commit is contained in:
2023-04-19 16:58:19 +03:00
parent b3fa29e4c5
commit 7a39e01b00
2 changed files with 21 additions and 2 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ module.exports = class logger {
constructor(filepath) {
this.#filepath = filepath
this.#filename = path.basename(filepath)
var dirname = path.dirname(filepath)
let dirname = path.dirname(filepath)
if (!fs.existsSync(dirname))
fs.mkdirSync(dirname, {recursive:true})
@@ -20,7 +20,7 @@ module.exports = class logger {
}
#log(message = '', ...arg) {
var args = ''
let args = ''
arg.forEach(value => {
args += util.format(value) + ' '
})
+19
View File
@@ -0,0 +1,19 @@
const get_date_time = () => {
let currentdate = new Date()
let datetime = currentdate.getDate() + "/"
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds()
return datetime
}
const get_unix_timestamp = () => {
return Math.floor(new Date().getTime() / 1000)
}
module.exports = {
get_date_time,
get_unix_timestamp
}