-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/pietrodev07/kittylog
- Loading branch information
Showing
16 changed files
with
92 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,4 @@ It is by default, so you don't need to add it! | |
} | ||
} | ||
``` | ||
::: | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
export const box = (message: string): void => { | ||
export const box = (...message: string[]): void => { | ||
let border = "──"; // We put 2 characters to have some distance from the edge | ||
|
||
for (let i = 0; i < message.length; i++) { | ||
for (let i = 0; i < message.join(" ").length; i++) { | ||
border += "─"; | ||
} | ||
|
||
console.log(`╭${border}╮\n│ ${message} │\n╰${border}╯`); | ||
console.log(`╭${border}╮\n│ ${message.join(" ")} │\n╰${border}╯`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
import { COLORS } from "../../constants"; | ||
import { colorsProvider } from "../../global"; | ||
|
||
export const error = (message: string | Error) => { | ||
export const error = (...message: string[] | Error[]) => { | ||
const { colorizeText, buildCompleteMessage } = colorsProvider; | ||
const label = colorizeText("[ERROR]", COLORS.red); | ||
|
||
if (typeof message === "string") { | ||
const messageColorized = colorizeText(message, COLORS.red); | ||
if (message[0] instanceof Error) { | ||
if (message.length > 1) throw new Error("Too many arguments for error function"); | ||
|
||
console.error(...buildCompleteMessage([label, messageColorized])); | ||
} else { | ||
const stack = `\n${message.stack?.split("\n").slice(1).join("\n")}`; | ||
const error = message[0]; | ||
|
||
const stack = `\n${error.stack?.split("\n").slice(1).join("\n")}`; | ||
|
||
const messageColorized = colorizeText(message.message, COLORS.red); | ||
const messageColorized = colorizeText(error.message, COLORS.red); | ||
const stackColorized = colorizeText(stack, COLORS.dim); | ||
|
||
console.error(...buildCompleteMessage([label, messageColorized, stackColorized])); | ||
} else { | ||
const messageColorized = colorizeText(message.join(" "), COLORS.red); | ||
|
||
console.error(...buildCompleteMessage([label, messageColorized])); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { COLORS } from "../../constants"; | ||
import { colorsProvider } from "../../global"; | ||
|
||
export const info = (message: string) => { | ||
export const info = (...message: string[]) => { | ||
const { colorizeText, buildCompleteMessage } = colorsProvider; | ||
|
||
const label = colorizeText("[INFO]", COLORS.cyan); | ||
const messageColorized = colorizeText(message, COLORS.cyan); | ||
const messageColorized = colorizeText(message.join(" "), COLORS.cyan); | ||
|
||
console.info(...buildCompleteMessage([label, messageColorized])); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { COLORS } from "../../constants"; | ||
import { colorsProvider } from "../../global"; | ||
|
||
export const success = (message: string) => { | ||
export const success = (...message: string[]) => { | ||
const { colorizeText, buildCompleteMessage } = colorsProvider; | ||
|
||
const label = colorizeText("[SUCCESS]", COLORS.green); | ||
const messageColorized = colorizeText(message, COLORS.green); | ||
const messageColorized = colorizeText(message.join(" "), COLORS.green); | ||
|
||
console.log(...buildCompleteMessage([label, messageColorized])); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { COLORS } from "../../constants"; | ||
import { colorsProvider } from "../../global"; | ||
|
||
export const warning = (message: string): void => { | ||
export const warning = (...message: string[]): void => { | ||
const { colorizeText, buildCompleteMessage } = colorsProvider; | ||
|
||
const label = colorizeText("[WARNING]", COLORS.yellow); | ||
const messageColorized = colorizeText(message, COLORS.yellow); | ||
const messageColorized = colorizeText(message.join(" "), COLORS.yellow); | ||
|
||
console.warn(...buildCompleteMessage([label, messageColorized])); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters