| 
269 | 269 |          *  | 
270 | 270 |          * Log time (full date) ?  | 
271 | 271 |          *  | 
272 |  | -         * @type {Boolean}  | 
 | 272 | +         * @type {Boolean|Number|String}  | 
273 | 273 |          */  | 
274 | 274 |         this._time = false;  | 
275 | 275 | 
 
  | 
 | 
287 | 287 |          *  | 
288 | 288 |          * Should we log filename and line number ?  | 
289 | 289 |          *  | 
290 |  | -         * @type {Boolean}  | 
 | 290 | +         * @type {Boolean|Object}  | 
291 | 291 |          */  | 
292 | 292 |         this._location = false;  | 
293 | 293 | 
 
  | 
 | 
325 | 325 |      * Console2.prototype.time  | 
326 | 326 |      *  | 
327 | 327 |      * Log the time  | 
 | 328 | +     *  | 
 | 329 | +     * @param {String|Number}   time    Optional time if need to override.  | 
328 | 330 |      */  | 
329 |  | -    Console2.prototype.time = function () {  | 
330 |  | -        this._time = true;  | 
 | 331 | +    Console2.prototype.time = function (time) {  | 
 | 332 | +        this._time = time || true;  | 
331 | 333 | 
 
  | 
332 | 334 |         return this;  | 
333 | 335 |     };  | 
 | 
362 | 364 |      * Console2.prototype.file  | 
363 | 365 |      *  | 
364 | 366 |      * Log the file name + line  | 
 | 367 | +     * You could force the filename and line by passing args.  | 
 | 368 | +     *  | 
 | 369 | +     * @param {String}          file    Filename. Optional  | 
 | 370 | +     * @param {String|Number}   line    Line. Optional  | 
365 | 371 |      */  | 
366 |  | -    Console2.prototype.file = Console2.prototype.f = function () {  | 
367 |  | -        this._location = true;  | 
 | 372 | +    Console2.prototype.file = Console2.prototype.f = function (file, line) {  | 
 | 373 | + | 
 | 374 | +        if (file || line) {  | 
 | 375 | +            this._location = {  | 
 | 376 | +                filename : file,  | 
 | 377 | +                line     : line  | 
 | 378 | +            };  | 
 | 379 | +        } else {  | 
 | 380 | +            this._location = true;  | 
 | 381 | +        }  | 
368 | 382 | 
 
  | 
369 | 383 |         return this;  | 
370 | 384 |     };  | 
 | 
569 | 583 |          */  | 
570 | 584 |         this[name] = function () {  | 
571 | 585 | 
 
  | 
572 |  | -            var location = getLocation();  | 
573 |  | -            var time     = Date.now();  | 
 | 586 | +            //use this._location if it's an object (custom location)  | 
 | 587 | +            //or build the location  | 
 | 588 | +            var location = (this._location || this.opt.alwaysLocation) === true ? getLocation() : this._location;  | 
 | 589 | + | 
 | 590 | +            var time     = (typeof this._time !== 'boolean') ? this._time : Date.now();  | 
574 | 591 | 
 
  | 
575 | 592 |             // Let's build the log object  | 
576 | 593 | 
 
  | 
577 | 594 |             var log = {  | 
578 | 595 |                 type       : opt.type || name,  | 
579 | 596 |                 show       : {  | 
580 | 597 |                     tags     : this._tags.length > 0 || this.opt.alwaysTags || opt.defaultTags.length > 0,  | 
581 |  | -                    location : this._location || this.opt.alwaysLocation,  | 
582 |  | -                    time     : this._time || this.opt.alwaysTime,  | 
 | 598 | +                    location : this._location !== false || this.opt.alwaysLocation,  | 
 | 599 | +                    time     : this._time !== false || this.opt.alwaysTime,  | 
583 | 600 |                     date     : this._date || this.opt.alwaysDate  | 
584 | 601 |                 },  | 
585 | 602 |                 context    : {  | 
 | 
0 commit comments