use dateformat to format date log
This commit is contained in:
@@ -3,6 +3,8 @@ SteamUser = require('steam-user');
|
||||
SteamTotp = require('steam-totp');
|
||||
fs = require('fs');
|
||||
winston = require("winston");
|
||||
dateformat = require('@matteo.collina/dateformat');
|
||||
|
||||
logger = winston.createLogger({
|
||||
level: 'info',
|
||||
format: winston.format.json(),
|
||||
@@ -138,9 +140,7 @@ steamUser.chat.on("friendMessageEcho", (message) => {
|
||||
* @returns {string}
|
||||
*/
|
||||
function dateToString(date) {
|
||||
let milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
||||
|
||||
return `${date.toLocaleString()}.${milliseconds}`
|
||||
return dateformat(date, "yyyy-mm-dd HH:MM:ss.l");
|
||||
}
|
||||
|
||||
function importChatHistory(steamID) {
|
||||
|
||||
22
package-lock.json
generated
22
package-lock.json
generated
@@ -9,13 +9,11 @@
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@matteo.collina/dateformat": "^5.0.1",
|
||||
"steam-totp": "^2.1.2",
|
||||
"steam-user": "^5.0.8",
|
||||
"steamcommunity": "^3.48.2",
|
||||
"winston": "^3.12.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.4.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@bbob/parser": {
|
||||
@@ -75,6 +73,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@doctormckay/user-agents/-/user-agents-1.0.0.tgz",
|
||||
"integrity": "sha512-F+sL1YmebZTY2CnjoR9BXFEULpq7y8dxyLx48LZVa0BSDseXdLG/DtPISfM1iNv1XKCeiBzVNfAT/MOQ69v1Zw=="
|
||||
},
|
||||
"node_modules/@matteo.collina/dateformat": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@matteo.collina/dateformat/-/dateformat-5.0.1.tgz",
|
||||
"integrity": "sha512-BxOmQxcfZxoo+qxI+/lQ28aoh1IpKAiuYLk7sIiCiqOXY9cWfMOwcyJY1xFWPQdHzYlMeeRo0oVABkB3b0ueWw=="
|
||||
},
|
||||
"node_modules/@protobufjs/aspromise": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
|
||||
@@ -1343,19 +1346,6 @@
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz",
|
||||
"integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@matteo.collina/dateformat": "^5.0.1",
|
||||
"steam-totp": "^2.1.2",
|
||||
"steam-user": "^5.0.8",
|
||||
"steamcommunity": "^3.48.2",
|
||||
|
||||
Reference in New Issue
Block a user