mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 19:37:34 -07:00
Add overload
This commit is contained in:
parent
9737cc9d9d
commit
37ae46128f
1 changed files with 4 additions and 1 deletions
|
@ -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): void;
|
||||||
export function log(level: LogLevel, message: string, domain: 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') {
|
if (typeof domain == 'string') {
|
||||||
log(level, `[${domain}] ${message}`);
|
log(level, `[${domain}] ${message}`);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue