@youpaichris/logger 6.1.3 → 6.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +5 -4
- package/package.json +1 -1
package/index.js
CHANGED
@@ -12,7 +12,7 @@ let logFilePath, logFile, successFilePath, successFile, errorFilePath, errorFile
|
|
12
12
|
|
13
13
|
const __log = console.log;
|
14
14
|
const __log__ = function () {
|
15
|
-
if (arguments[3] === '\x1B[41m') {
|
15
|
+
if (arguments[3] === '\x1B[0m\x1B[1m\x1B[41m') {
|
16
16
|
arguments[4] = "\b" + arguments[4];
|
17
17
|
arguments[arguments.length - 1] += consoleStyles['redBG'][1] + consoleStyles['bold'][1] + '\b';
|
18
18
|
}
|
@@ -53,7 +53,7 @@ Object.defineProperty(global, '__stack', {
|
|
53
53
|
Object.defineProperty(global, '__line', {
|
54
54
|
get: function () {
|
55
55
|
const stack = new Error().stack.split('\n').slice(2);
|
56
|
-
const caller = stack[1].trim();
|
56
|
+
const caller = stack[1].includes(`@youpaichris/logger/index.js`) ? stack[2] .trim() : stack[1].trim();
|
57
57
|
const index = caller.indexOf('at ') + 3;
|
58
58
|
const clean = caller.slice(index);
|
59
59
|
const parts = clean.split(':');
|
@@ -252,12 +252,13 @@ class Logger {
|
|
252
252
|
};
|
253
253
|
|
254
254
|
critical(...msg) {
|
255
|
+
// \x1B[0m\x1B[41m\x1B[1m
|
255
256
|
this.#prefix && msg.unshift(this.#prefix);
|
256
257
|
let pathLine = this?.path ? `[${this.path}:${__line}]` : "Anonymous";
|
257
258
|
loggerConfig.log(consoleStyles['green'][0] + dateFormat("YYYY-mm-dd HH:MM:SS.ms", new loggerConfig.Date()),
|
258
259
|
consoleStyles['red'][0] + consoleStyles['bold'][0] + "| " +
|
259
|
-
|
260
|
-
consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['cyan'][0]}🔴
|
260
|
+
'\x1B[0m' + consoleStyles['bold'][0] + consoleStyles['redBG'][0] + "CRITICAL" + consoleStyles['redBG'][1] + consoleStyles['red'][0] + " |" +
|
261
|
+
consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['cyan'][0]}🔴 `, '\x1B[0m' + consoleStyles['bold'][0] + consoleStyles['redBG'][0],
|
261
262
|
...msg,
|
262
263
|
consoleStyles['redBG'][1] + consoleStyles['bold'][1] + '\b', consoleStyles['redBG'][1] + consoleStyles['bold'][1] + '\b'
|
263
264
|
);
|