Skip to content

Commit 2dc7283

Browse files
committed
color logs
1 parent e132c0f commit 2dc7283

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

logger.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,26 @@ interface Logger {
3333

3434
const Logger: Logger = {
3535
info: (taq: string, indicator: string, message: string = "UNIVERSAL") => {
36-
console.log(`[INFO][${taq}][${indicator}]`, message);
36+
console.log(`\x1b[30m\x1b[42m[INFO][${taq}]\x1b[0m[${indicator}]`, message);
3737
},
3838
debug: (taq: string, indicator: string, message: string = "UNIVERSAL") => {
3939
if (isDev) {
40-
console.log(`[DEV][${taq}][${indicator}]`, message);
40+
console.log(`\x1b[30m\x1b[44m[DEV][${taq}]\x1b[0m[${indicator}]`, message);
4141
}
4242
},
4343
dLog: (taq: string, indicator: string, data: any = " ") => {
4444
if (isDev) {
45-
console.log('---------------------------------\n');
46-
console.log(`[DEV][${taq}]`, indicator);
45+
console.log('\x1b[30m\x1b[43m---------------------------------\x1b[0m');
46+
console.log(`\x1b[30m\x1b[43m[DEV][${taq}]\x1b[0m[${indicator}]`);
4747
console.log(data);
48-
console.log('---------------------------------\n');
48+
console.log('\x1b[30m\x1b[43m---------------------------------\x1b[0m');
4949
}
5050
},
5151
warn: (taq: string, indicator: string, message: string = "UNIVERSAL") => {
52-
console.warn(`[WARN][${taq}][${indicator}]`, message);
52+
console.warn(`\x1b[30m\x1b[43m[WARN]\x1b[0m\x1b[30m\x1b[43m[${taq}]\x1b[0m[${indicator}]`, message);
5353
},
5454
error: (taq: string, indicator: string, message: string = "UNIVERSAL") => {
55-
console.error(`[ERROR][${taq}][${indicator}]`, message);
55+
console.error(`\x1b[30m\x1b[41m[ERROR]\x1b[0m\x1b[30m\x1b[41m[${taq}]\x1b[0m[${indicator}]`, message);
5656
}
5757
};
5858

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-dlogger",
3-
"version": "1.0.3",
3+
"version": "2.0.0",
44
"description": "A lightweight and efficient logging utility for JavaScript applications. This package provides multiple logging functions such as info(), dLog(), warn(), debug and error(), displaying logs in the console along with the filename for better debugging and traceability. Perfect for developers looking for a simple yet powerful logging solution.",
55
"main": "logger.ts",
66
"scripts": {

0 commit comments

Comments
 (0)