@qqi/log 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/cjs/core.js +10 -8
  2. package/es/core.js +11 -9
  3. package/package.json +1 -1
package/cjs/core.js CHANGED
@@ -71,18 +71,20 @@ function Dog(options) {
71
71
  }
72
72
  }
73
73
  _this.mark = mark;
74
- return "".concat(printStartPenStr, " ").concat(mark, " ").concat((_f = res === null || res === void 0 ? void 0 : res.line) === null || _f === void 0 ? void 0 : _f.concat(' 行'), " ").concat((_g = res === null || res === void 0 ? void 0 : res.column) === null || _g === void 0 ? void 0 : _g.concat(' 列'));
74
+ var msg = "".concat(printStartPenStr, " ").concat(mark, " ").concat((_f = res === null || res === void 0 ? void 0 : res.line) === null || _f === void 0 ? void 0 : _f.concat(' 行'), " ").concat((_g = res === null || res === void 0 ? void 0 : res.column) === null || _g === void 0 ? void 0 : _g.concat(' 列'));
75
+ return colorPen.colorText(msg);
75
76
  }
76
77
  };
77
78
  this.info = function () {
78
- var msg = [];
79
+ var arg = [];
79
80
  for (var _i = 0; _i < arguments.length; _i++) {
80
- msg[_i] = arguments[_i];
81
+ arg[_i] = arguments[_i];
81
82
  }
82
83
  if (_this.type === 'all' || _this.type === 'info' || _this.type === true) {
83
84
  var _prefix = prefix('info');
84
- msg.unshift(_prefix);
85
- console.log.apply(console, msg);
85
+ console.log.apply(console, _prefix);
86
+ console.log.apply(console, arg);
87
+ // console.log.apply(console, arg);
86
88
  }
87
89
  };
88
90
  /**
@@ -95,7 +97,7 @@ function Dog(options) {
95
97
  }
96
98
  if (_this.type === 'all' || _this.type === 'warn' || _this.type === true) {
97
99
  var _prefix = prefix('warn');
98
- msg.unshift(_prefix);
100
+ console.log.apply(console, _prefix);
99
101
  console.warn.apply(console, msg);
100
102
  }
101
103
  };
@@ -110,7 +112,7 @@ function Dog(options) {
110
112
  }
111
113
  if (_this.type === 'all' || _this.type === 'error' || _this.type === true) {
112
114
  var _prefix = prefix('error');
113
- msg.unshift(_prefix);
115
+ console.log.apply(console, _prefix);
114
116
  console.error.apply(console, msg);
115
117
  }
116
118
  };
@@ -123,7 +125,7 @@ function Dog(options) {
123
125
  for (var _i = 0; _i < arguments.length; _i++) {
124
126
  str[_i] = arguments[_i];
125
127
  }
126
- _this.info(str);
128
+ _this.info.apply(_this, str);
127
129
  };
128
130
  // 设置 prototype
129
131
  Object.setPrototypeOf(dog, this);
package/es/core.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { esc } from '@color-pen/static';
2
2
  import { createConstructor, getRandomString } from 'a-js-tools';
3
- import { bgCyanPen, bgBlackPen, bgBrightYellowPen } from 'color-pen';
3
+ import { bgCyanPen, bgBlackPen, bgBrightYellowPen, colorText } from 'color-pen';
4
4
  import { parseOption, getEnv, platform, setType } from './util.js';
5
5
 
6
6
  /**
@@ -69,18 +69,20 @@ function Dog(options) {
69
69
  }
70
70
  }
71
71
  _this.mark = mark;
72
- return "".concat(printStartPenStr, " ").concat(mark, " ").concat((_f = res === null || res === void 0 ? void 0 : res.line) === null || _f === void 0 ? void 0 : _f.concat(' 行'), " ").concat((_g = res === null || res === void 0 ? void 0 : res.column) === null || _g === void 0 ? void 0 : _g.concat(' 列'));
72
+ var msg = "".concat(printStartPenStr, " ").concat(mark, " ").concat((_f = res === null || res === void 0 ? void 0 : res.line) === null || _f === void 0 ? void 0 : _f.concat(' 行'), " ").concat((_g = res === null || res === void 0 ? void 0 : res.column) === null || _g === void 0 ? void 0 : _g.concat(' 列'));
73
+ return colorText(msg);
73
74
  }
74
75
  };
75
76
  this.info = function () {
76
- var msg = [];
77
+ var arg = [];
77
78
  for (var _i = 0; _i < arguments.length; _i++) {
78
- msg[_i] = arguments[_i];
79
+ arg[_i] = arguments[_i];
79
80
  }
80
81
  if (_this.type === 'all' || _this.type === 'info' || _this.type === true) {
81
82
  var _prefix = prefix('info');
82
- msg.unshift(_prefix);
83
- console.log.apply(console, msg);
83
+ console.log.apply(console, _prefix);
84
+ console.log.apply(console, arg);
85
+ // console.log.apply(console, arg);
84
86
  }
85
87
  };
86
88
  /**
@@ -93,7 +95,7 @@ function Dog(options) {
93
95
  }
94
96
  if (_this.type === 'all' || _this.type === 'warn' || _this.type === true) {
95
97
  var _prefix = prefix('warn');
96
- msg.unshift(_prefix);
98
+ console.log.apply(console, _prefix);
97
99
  console.warn.apply(console, msg);
98
100
  }
99
101
  };
@@ -108,7 +110,7 @@ function Dog(options) {
108
110
  }
109
111
  if (_this.type === 'all' || _this.type === 'error' || _this.type === true) {
110
112
  var _prefix = prefix('error');
111
- msg.unshift(_prefix);
113
+ console.log.apply(console, _prefix);
112
114
  console.error.apply(console, msg);
113
115
  }
114
116
  };
@@ -121,7 +123,7 @@ function Dog(options) {
121
123
  for (var _i = 0; _i < arguments.length; _i++) {
122
124
  str[_i] = arguments[_i];
123
125
  }
124
- _this.info(str);
126
+ _this.info.apply(_this, str);
125
127
  };
126
128
  // 设置 prototype
127
129
  Object.setPrototypeOf(dog, this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "name": "@qqi/log",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",