Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7
CHANGELOG | ||
v1.0.0-alpha.7 | ||
- probe timings | ||
v1.0.0-alpha.6 | ||
- Experimental image utils | ||
- new Stats class | ||
- Browser automation BrowserTestDriver | ||
- experimental image utils | ||
@@ -6,0 +12,0 @@ v1.0.0-alpha.5 |
@@ -238,3 +238,4 @@ 'use strict'; | ||
args: args, | ||
method: originalConsole.log | ||
method: originalConsole.log, | ||
time: true | ||
}); | ||
@@ -483,3 +484,3 @@ } | ||
message = (0, _color.addColor)(message, opts.color, opts.background); | ||
message = this._decorateMessage(message, opts); | ||
@@ -501,11 +502,11 @@ // Bind console function so that it can be called after being returned | ||
key: '_parseArguments', | ||
value: function _parseArguments(_ref3) { | ||
var priority = _ref3.priority, | ||
message = _ref3.message, | ||
_ref3$args = _ref3.args, | ||
args = _ref3$args === undefined ? [] : _ref3$args, | ||
_ref3$opts = _ref3.opts, | ||
opts = _ref3$opts === undefined ? {} : _ref3$opts; | ||
value: function _parseArguments(options) { | ||
var priority = options.priority, | ||
message = options.message, | ||
_options$args = options.args, | ||
args = _options$args === undefined ? [] : _options$args, | ||
_options$opts = options.opts, | ||
opts = _options$opts === undefined ? {} : _options$opts; | ||
var newOpts = this._normalizeArguments({ priority: priority, message: message, args: args }); | ||
var normOpts = this._normalizeArguments({ priority: priority, message: message, args: args }); | ||
@@ -516,4 +517,6 @@ var _getElapsedTime2 = this._getElapsedTime(), | ||
return Object.assign(newOpts, opts, { | ||
message: typeof newOpts === 'string' ? this.id + ': ' + newOpts.message : newOpts.message, | ||
// original opts + normalized opts + opts arg + fixed up message + timings | ||
return Object.assign(options, normOpts, opts, { | ||
delta: delta, | ||
@@ -528,7 +531,7 @@ total: total | ||
key: '_normalizeArguments', | ||
value: function _normalizeArguments(_ref4) { | ||
var priority = _ref4.priority, | ||
message = _ref4.message, | ||
_ref4$args = _ref4.args, | ||
args = _ref4$args === undefined ? [] : _ref4$args; | ||
value: function _normalizeArguments(_ref3) { | ||
var priority = _ref3.priority, | ||
message = _ref3.message, | ||
_ref3$args = _ref3.args, | ||
args = _ref3$args === undefined ? [] : _ref3$args; | ||
@@ -574,2 +577,18 @@ var newOpts = null; | ||
}, { | ||
key: '_decorateMessage', | ||
value: function _decorateMessage(message, opts) { | ||
if (typeof message === 'string') { | ||
var time = ''; | ||
if (opts.time) { | ||
var _getElapsedTime3 = this._getElapsedTime(), | ||
total = _getElapsedTime3.total; | ||
time = (0, _formatters.leftPad)((0, _formatters.formatTime)(total)); | ||
} | ||
message = opts.time ? this.id + ': ' + time + ' ' + message : this.id + ': ' + time + ' ' + message; | ||
message = (0, _color.addColor)(message, opts.color, opts.background); | ||
} | ||
return message; | ||
} | ||
}, { | ||
key: 'priority', | ||
@@ -576,0 +595,0 @@ set: function set(newPriority) { |
@@ -24,3 +24,3 @@ 'use strict'; | ||
/* global __VERSION__ */ | ||
var VERSION = typeof '1.0.0-alpha.6' !== 'undefined' ? '1.0.0-alpha.6' : 'untranspiled source'; | ||
var VERSION = typeof '1.0.0-alpha.7' !== 'undefined' ? '1.0.0-alpha.7' : 'untranspiled source'; | ||
@@ -27,0 +27,0 @@ exports.window = window_; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.0-alpha.6", | ||
"version": "1.0.0-alpha.7", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "javascript", |
@@ -26,3 +26,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
import {getTimestamp} from './utils/timestamp'; | ||
import {formatImage} from './utils/formatters'; | ||
import {formatImage, formatTime, leftPad} from './utils/formatters'; | ||
import {addColor} from './utils/color'; | ||
@@ -190,3 +190,4 @@ import {autobind} from './utils/autobind'; | ||
args, | ||
method: originalConsole.log | ||
method: originalConsole.log, | ||
time: true | ||
}); | ||
@@ -373,3 +374,3 @@ } | ||
message = addColor(message, opts.color, opts.background); | ||
message = this._decorateMessage(message, opts); | ||
@@ -388,9 +389,10 @@ // Bind console function so that it can be called after being returned | ||
// - log({priority, message, args}) => {priority, message, args} | ||
_parseArguments({priority, message, args = [], opts = {}}) { | ||
const newOpts = this._normalizeArguments({priority, message, args}); | ||
_parseArguments(options) { | ||
const {priority, message, args = [], opts = {}} = options; | ||
const normOpts = this._normalizeArguments({priority, message, args}); | ||
const {delta, total} = this._getElapsedTime(); | ||
return Object.assign(newOpts, opts, { | ||
message: typeof newOpts === 'string' ? `${this.id}: ${newOpts.message}` : newOpts.message, | ||
// original opts + normalized opts + opts arg + fixed up message + timings | ||
return Object.assign(options, normOpts, opts, { | ||
delta, | ||
@@ -441,4 +443,17 @@ total | ||
} | ||
_decorateMessage(message, opts) { | ||
if (typeof message === 'string') { | ||
let time = ''; | ||
if (opts.time) { | ||
const {total} = this._getElapsedTime(); | ||
time = leftPad(formatTime(total)); | ||
} | ||
message = opts.time ? `${this.id}: ${time} ${message}` : `${this.id}: ${time} ${message}`; | ||
message = addColor(message, opts.color, opts.background); | ||
} | ||
return message; | ||
} | ||
} | ||
Log.VERSION = VERSION; |
Sorry, the diff of this file is not supported yet
250664
3870