time added and var with let replaced
This commit is contained in:
+2
-2
@@ -7,7 +7,7 @@ module.exports = class logger {
|
|||||||
constructor(filepath) {
|
constructor(filepath) {
|
||||||
this.#filepath = filepath
|
this.#filepath = filepath
|
||||||
this.#filename = path.basename(filepath)
|
this.#filename = path.basename(filepath)
|
||||||
var dirname = path.dirname(filepath)
|
let dirname = path.dirname(filepath)
|
||||||
|
|
||||||
if (!fs.existsSync(dirname))
|
if (!fs.existsSync(dirname))
|
||||||
fs.mkdirSync(dirname, {recursive:true})
|
fs.mkdirSync(dirname, {recursive:true})
|
||||||
@@ -20,7 +20,7 @@ module.exports = class logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#log(message = '', ...arg) {
|
#log(message = '', ...arg) {
|
||||||
var args = ''
|
let args = ''
|
||||||
arg.forEach(value => {
|
arg.forEach(value => {
|
||||||
args += util.format(value) + ' '
|
args += util.format(value) + ' '
|
||||||
})
|
})
|
||||||
|
|||||||
+19
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user