From ebe3225e0c8f1b28ba15929fff8be3fe4396c31a Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 29 Dec 2016 21:14:47 +0900 Subject: [PATCH] Add overload --- src/utils/logger.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 2189dd5ea5..495035d478 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -10,9 +10,12 @@ function toLevelColor(level: LogLevel): chalk.ChalkStyle { } } +export function log(message: string): void; export function log(level: LogLevel, message: string): void; export function log(level: LogLevel, message: string, domain: string): void; -export function log(level: LogLevel, message: string, domain?: string): void { +export function log(x: string | LogLevel, message?: string, domain?: string): void { + const level = typeof message == 'undefined' ? 'Info' : x as LogLevel; + message = typeof message == 'undefined' ? x : message; if (typeof domain == 'string') { log(level, `[${domain}] ${message}`); } else {