fix: fix time format in logger
This commit is contained in:
parent
0f62409e88
commit
3b33e7f9ae
@ -9,7 +9,7 @@ interface LogInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const customFormat = format.combine(
|
const customFormat = format.combine(
|
||||||
timestamp({ format: "YY-MM-DD HH:MM:SS" }),
|
timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
|
||||||
printf((info: LogInfo) => {
|
printf((info: LogInfo) => {
|
||||||
return `[${info.timestamp}] ${info.level}: ${info.message}`;
|
return `[${info.timestamp}] ${info.level}: ${info.message}`;
|
||||||
})
|
})
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* Gets the current date as YYYY-MM-DD.
|
|
||||||
*
|
|
||||||
* @returns the date
|
|
||||||
*/
|
|
||||||
export function getFormattedDate() {
|
|
||||||
return new Date().toISOString().slice(0, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats a timestamp as YYYY-MM-DD.
|
|
||||||
*
|
|
||||||
* @param timestamp the timestamp
|
|
||||||
* @returns the formatted timestamp
|
|
||||||
*/
|
|
||||||
export function formatTimestamp(timestamp: number) {
|
|
||||||
return new Date(timestamp).toISOString().slice(0, 10);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user