@youpaichris/logger 6.1.4 → 6.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +10 -9
  2. package/package.json +1 -1
  3. package/tests.js +0 -24
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
  }
@@ -166,7 +166,7 @@ class Logger {
166
166
  loggerConfig.log(consoleStyles['green'][0] + dateFormat("YYYY-mm-dd HH:MM:SS.ms", new loggerConfig.Date()),
167
167
  consoleStyles['red'][0] + consoleStyles['bold'][0] + "| " +
168
168
  consoleStyles['bold'][0] + consoleStyles['blue'][0] + "INFO " + consoleStyles['red'][0] + " |" +
169
- consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['blue'][0]}📡`, consoleStyles['blue'][0],
169
+ consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['blue'][0]}📢`, consoleStyles['blue'][0],
170
170
  ...msg,
171
171
  consoleStyles['blue'][1] + consoleStyles['bold'][1] + '\b'
172
172
  );
@@ -179,7 +179,7 @@ class Logger {
179
179
  loggerConfig.log(consoleStyles['green'][0] + dateFormat("YYYY-mm-dd HH:MM:SS.ms", new loggerConfig.Date()),
180
180
  consoleStyles['red'][0] + consoleStyles['bold'][0] + "| " +
181
181
  consoleStyles['bold'][0] + consoleStyles['yellow'][0] + "WARNING " + consoleStyles['red'][0] + " |" +
182
- consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['yellow'][0]}💡`, consoleStyles['yellow'][0],
182
+ consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['yellow'][0]}🚨️`, consoleStyles['yellow'][0],
183
183
  ...msg,
184
184
  consoleStyles['yellow'][1] + consoleStyles['bold'][1] + '\b'
185
185
  );
@@ -192,7 +192,7 @@ class Logger {
192
192
  loggerConfig.error(consoleStyles['green'][0] + dateFormat("YYYY-mm-dd HH:MM:SS.ms", new loggerConfig.Date()),
193
193
  consoleStyles['red'][0] + consoleStyles['bold'][0] + "| " +
194
194
  consoleStyles['bold'][0] + consoleStyles['red'][0] + "ERROR " + consoleStyles['red'][0] + " |" +
195
- consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['red'][0]}🚨`, consoleStyles['red'][0],
195
+ consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['red'][0]}❌️`, consoleStyles['red'][0],
196
196
  ...msg,
197
197
  consoleStyles['red'][1] + consoleStyles['bold'][1] + '\b'
198
198
  );
@@ -210,7 +210,7 @@ class Logger {
210
210
  loggerConfig.log(consoleStyles['green'][0] + dateFormat("YYYY-mm-dd HH:MM:SS.ms", new loggerConfig.Date()),
211
211
  consoleStyles['red'][0] + consoleStyles['bold'][0] + "| " +
212
212
  consoleStyles['bold'][0] + consoleStyles['green'][0] + "SUCCESS " + consoleStyles['red'][0] + " |" +
213
- consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['green'][0]}🎯`, consoleStyles['green'][0],
213
+ consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['green'][0]}✅️`, consoleStyles['green'][0],
214
214
  ...msg,
215
215
  consoleStyles['green'][1] + consoleStyles['bold'][1] + '\b'
216
216
  );
@@ -229,7 +229,7 @@ class Logger {
229
229
  loggerConfig.log(consoleStyles['green'][0] + dateFormat("YYYY-mm-dd HH:MM:SS.ms", new loggerConfig.Date()),
230
230
  consoleStyles['red'][0] + consoleStyles['bold'][0] + "| " +
231
231
  consoleStyles['bold'][0] + consoleStyles['cyan'][0] + "DEBUG " + consoleStyles['red'][0] + " |" +
232
- consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['cyan'][0]}🚧`, consoleStyles['cyan'][0],
232
+ consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['cyan'][0]}🐞`, consoleStyles['cyan'][0],
233
233
  ...msg,
234
234
  consoleStyles['magenta'][1] + consoleStyles['bold'][1] + '\b'
235
235
  );
@@ -243,7 +243,7 @@ class Logger {
243
243
  loggerConfig.log(consoleStyles['green'][0] + dateFormat("YYYY-mm-dd HH:MM:SS.ms", new loggerConfig.Date()),
244
244
  consoleStyles['red'][0] + consoleStyles['bold'][0] + "| " +
245
245
  consoleStyles['bold'][0] + consoleStyles['magenta'][0] + "CALL " + consoleStyles['red'][0] + " |" +
246
- consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['magenta'][0]}🔔`, consoleStyles['magenta'][0],
246
+ consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['magenta'][0]}🆑`, consoleStyles['magenta'][0],
247
247
  ...msg,
248
248
  consoleStyles['cyan'][1] + consoleStyles['bold'][1] + '\b'
249
249
  );
@@ -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
- consoleStyles['bold'][0] + consoleStyles['redBG'][0] + consoleStyles['white'][0] + "CRITICAL" + consoleStyles['redBG'][1] + consoleStyles['red'][0] + " |" +
260
- consoleStyles['blue'][0], ` ${pathLine.padEnd(22, " ")}${consoleStyles['cyan'][0]}🔴 ${consoleStyles['white'][0]}`, consoleStyles['redBG'][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
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youpaichris/logger",
3
- "version": "6.1.4",
3
+ "version": "6.1.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tests.js DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * @File : tests.js
3
- * @Time : 2024/7/18 14:57
4
- * @Author : Chris
5
- * @Email : 10512@qq.com
6
- * @Software : WebStorm
7
- * @Platform : macOS
8
- * */
9
- const Logger = require('./index.js');
10
-
11
- const logger = new Logger();
12
-
13
- logger.info("info")
14
- logger.debug("debug");
15
- logger.error("error");
16
- logger.warn("warn");
17
- logger.success("success");
18
- logger.call("call");
19
- logger.critical("critical");
20
- logger.info({name: 1}, {name: 2}, 333);
21
- (async ()=>{
22
- let e = await logger.input("input something");
23
- logger.info(e);
24
- })()