@miso.ai/client-sdk-dev-tool 1.14.0-beta.3 → 1.14.0-beta.4

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.
package/dist/cjs/debug.js CHANGED
@@ -162,14 +162,16 @@ class DebugPlugin {
162
162
  } = {}) {
163
163
  path = _joinPath(path);
164
164
  this._write([_path(path), _name(name), ...data], {
165
- silent: silent || this._isMuted(path)
165
+ silent: silent || this._isMuted(path),
166
+ error: name === 'error'
166
167
  });
167
168
  }
168
169
  _logr(...data) {
169
170
  this._write(data);
170
171
  }
171
172
  _write(data, {
172
- silent = false
173
+ silent = false,
174
+ error = false
173
175
  } = {}) {
174
176
  const options = this._options.console || {};
175
177
  if (this._options.preserveLog) {
@@ -178,7 +180,7 @@ class DebugPlugin {
178
180
  if (silent) {
179
181
  return;
180
182
  }
181
- console.log(_tag(options), _style(options), ...data);
183
+ console.log(_tag(options), _style(options, error), ...data);
182
184
  }
183
185
  _isMuted(path) {
184
186
  const {
@@ -193,10 +195,14 @@ function _tag({
193
195
  } = {}) {
194
196
  return `%c${text}`;
195
197
  }
198
+
199
+ // an error event stands out with a red tag
196
200
  function _style({
197
201
  color = '#fff',
198
- background = '#334cbb'
199
- } = {}) {
202
+ background = '#334cbb',
203
+ errorBackground = '#c0392b'
204
+ } = {}, error = false) {
205
+ background = error ? errorBackground : background;
200
206
  return `color: ${color}; background-color: ${background}; padding: 2px 2px 1px 4px;`;
201
207
  }
202
208
 
package/package.json CHANGED
@@ -30,9 +30,9 @@
30
30
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@miso.ai/commons": "1.14.0-beta.3",
34
- "@miso.ai/doggoganger": "^0.10.0-beta.17",
35
- "@miso.ai/lorem": "^0.10.0-beta.17"
33
+ "@miso.ai/commons": "1.14.0-beta.4",
34
+ "@miso.ai/doggoganger": "^0.10.0-beta.18",
35
+ "@miso.ai/lorem": "^0.10.0-beta.18"
36
36
  },
37
- "version": "1.14.0-beta.3"
37
+ "version": "1.14.0-beta.4"
38
38
  }
package/src/debug.js CHANGED
@@ -150,14 +150,14 @@ export default class DebugPlugin {
150
150
 
151
151
  _logp(path, name, data, { silent = false } = {}) {
152
152
  path = _joinPath(path);
153
- this._write([_path(path), _name(name), ...data], { silent: silent || this._isMuted(path) });
153
+ this._write([_path(path), _name(name), ...data], { silent: silent || this._isMuted(path), error: name === 'error' });
154
154
  }
155
155
 
156
156
  _logr(...data) {
157
157
  this._write(data);
158
158
  }
159
159
 
160
- _write(data, { silent = false } = {}) {
160
+ _write(data, { silent = false, error = false } = {}) {
161
161
  const options = this._options.console || {};
162
162
  if (this._options.preserveLog) {
163
163
  this._logs._logs.push(data);
@@ -165,7 +165,7 @@ export default class DebugPlugin {
165
165
  if (silent) {
166
166
  return;
167
167
  }
168
- console.log(_tag(options), _style(options), ...data);
168
+ console.log(_tag(options), _style(options, error), ...data);
169
169
  }
170
170
 
171
171
  _isMuted(path) {
@@ -179,7 +179,9 @@ function _tag({ text = 'Miso' } = {}) {
179
179
  return `%c${text}`;
180
180
  }
181
181
 
182
- function _style({ color = '#fff', background = '#334cbb' } = {}) {
182
+ // an error event stands out with a red tag
183
+ function _style({ color = '#fff', background = '#334cbb', errorBackground = '#c0392b' } = {}, error = false) {
184
+ background = error ? errorBackground : background;
183
185
  return `color: ${color}; background-color: ${background}; padding: 2px 2px 1px 4px;`;
184
186
  }
185
187