@apigames/logger
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -16,4 +16,11 @@ "use strict"; | ||
}, | ||
_a.write = (type, message, payload) => __awaiter(void 0, void 0, void 0, function* () { | ||
console.log(`${type}: ${message}`); | ||
_a.write = (type, message, payload, date) => __awaiter(void 0, void 0, void 0, function* () { | ||
let messageDate = date; | ||
if (!messageDate) { | ||
messageDate = new Date(); | ||
} | ||
let typeStr = type; | ||
while (typeStr.length < 7) | ||
typeStr += ' '; | ||
console.log(`${messageDate.toISOString()} ${typeStr.toUpperCase()} ${message}`); | ||
if (!json_1.isEmpty(payload)) { | ||
@@ -20,0 +27,0 @@ console.log(json_1.stringify(payload)); |
@@ -9,3 +9,3 @@ export declare enum LoggerMessageType { | ||
export interface ILogger { | ||
write(type: LoggerMessageType, message: string, payload?: LoggerPayload): Promise<void>; | ||
write(type: LoggerMessageType, message: string, payload?: LoggerPayload, date?: Date): Promise<void>; | ||
} |
@@ -6,3 +6,3 @@ { | ||
"license": "UNLICENSED", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"main": "lib/index.js", | ||
@@ -9,0 +9,0 @@ "types": "lib/index.d.ts", |
5205
71