Allow custom time

This commit is contained in:
Guillaume Wuip 2015-02-02 18:13:32 +01:00
parent 19728e4a24
commit 2747cff88e

View file

@ -269,7 +269,7 @@
*
* Log time (full date) ?
*
* @type {Boolean}
* @type {Boolean|Number|String}
*/
this._time = false;
@ -325,9 +325,11 @@
* Console2.prototype.time
*
* Log the time
*
* @param {String|Number} time Optional time if need to override.
*/
Console2.prototype.time = function () {
this._time = true;
Console2.prototype.time = function (time) {
this._time = time || true;
return this;
};
@ -585,7 +587,7 @@
//or build the location
var location = (this._location || this.opt.alwaysLocation) === true ? getLocation() : this._location;
var time = Date.now();
var time = (typeof this._time !== 'boolean') ? this._time : Date.now();
// Let's build the log object
@ -594,7 +596,7 @@
show : {
tags : this._tags.length > 0 || this.opt.alwaysTags || opt.defaultTags.length > 0,
location : this._location !== false || this.opt.alwaysLocation,
time : this._time || this.opt.alwaysTime,
time : this._time !== false || this.opt.alwaysTime,
date : this._date || this.opt.alwaysDate
},
context : {