From 5ef41e82e467ea357accee9853da40a62ec87d54 Mon Sep 17 00:00:00 2001 From: dondish Date: Sun, 18 Aug 2019 19:06:19 +0300 Subject: [PATCH] Added the log function to help TypeScript Users --- index.d.ts | 2 +- lib/pikmin/instance.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index ca430f9..de70450 100644 --- a/index.d.ts +++ b/index.d.ts @@ -14,7 +14,7 @@ declare namespace Pikmin { public baseFormat: string; public transports: Pikmin.Transport[]; - public [x: string]: function(msg, ...args): void; + public log(type: string, msg: string, ...options): void; public addTransport(transport: Pikmin.Transport, options?: { autogen: boolean }): void; } diff --git a/lib/pikmin/instance.js b/lib/pikmin/instance.js index 6e7220b..5d5bb7b 100644 --- a/lib/pikmin/instance.js +++ b/lib/pikmin/instance.js @@ -54,6 +54,10 @@ module.exports = class PikminInstance { Pikmin.loggers.set(this.name, this.__log__); } + log(transportName, msg, ...args) { + this[transportName](msg, ...args) + } + addTransport(transport, options = { autogen: false }) { const now = this._formatDate();