var Transform = require('../../common/transform.js'),
    style = require('./util.js').style;

function FormatNpm() {}

Transform.mixin(FormatNpm);

FormatNpm.prototype.write = function(name, level, args) {
  var colors = { debug: 'magenta', info: 'cyan', warn: 'yellow', error: 'red' };
  function pad(s) { return (s.toString().length == 4? ' '+s : s); }
  function getStack() {
    var orig = Error.prepareStackTrace;
    Error.prepareStackTrace = function (err, stack) {
      return stack;
    };
    var err = new Error;
    Error.captureStackTrace(err, arguments.callee);
    var stack = err.stack;
    Error.prepareStackTrace = orig;
    return stack;
  }

  var frame = getStack()[4];

  this.emit('item', (name ? name + ' ' : '')
          + (level ? style(pad(level), colors[level]) + ' ' : '')
          + style(
              frame.getFileName().replace(new RegExp('^.*/(.+)$'), '/$1')
              + ":" + frame.getLineNumber()
            , 'grey')
          + ' '
          + args.join(' '));
};

module.exports = FormatNpm;


@@ -142,16 +142,260 @@
 tNpm);%0A%0A
+function noop(a)%7B%0A  return a;%0A%7D%0A%0Avar types = %7B%0A  string: noop,%0A  number: noop,%0A  default: JSON.stringify.bind(JSON)%0A%7D;%0A%0Afunction stringify(args) %7B%0A  return args.map(function(arg) %7B%0A    return (types%5Btypeof arg%5D %7C%7C types.default)(arg);%0A  %7D);%0A%7D%0A%0A
 FormatNp
@@ -930,10 +930,120 @@
 k()%5B
-4%5D
+5%5D,%0A      fileName = FormatNpm.fullPath ? frame.getFileName() : frame.getFileName().replace(/%5E.*%5C/(.+)$/, '/$1')
 ;%0A%0A 
@@ -1174,96 +1174,16 @@
 yle(
-%0A              frame.getFileName().replace(new RegExp('%5E.*/(.+)$'), '/$1')%0A             
+fileName
  + %22
@@ -1212,21 +1212,8 @@
 er()
-%0A            
 , 'g
@@ -1246,20 +1246,31 @@
       + 
+stringify(
 args
+)
 .join(' 
@@ -1278,16 +1278,44 @@
 ));%0A%7D;%0A%0A
+FormatNpm.fullPath = true;%0A%0A
 module.e

Change stack formatting in npm