diff --git a/ais-structure/src/modules/helper/log.js b/ais-structure/src/modules/helper/log.js index f4690cc..4c1f713 100644 --- a/ais-structure/src/modules/helper/log.js +++ b/ais-structure/src/modules/helper/log.js @@ -37,7 +37,19 @@ logger.stat = function (msg){ logger.log = function (msg,type) { + function getErrorObject(){ + try { throw Error('') } catch(err) { return err; } + } + + var err = getErrorObject(); + var caller_line = err.stack.split("\n")[4]; + var index = caller_line.indexOf("at "); + var clean = caller_line.slice(index+2, caller_line.length); + var focus = clean.split('\\'); + var line = focus[focus.length-1].slice(0, -1).split(":"); + msg = line[0]+'|'+line[1]+'|'+line[2]+'| '+msg; + if(!type) type = 'debug'; @@ -60,6 +72,11 @@ logger.log = function (msg,type) logg.debug(msg); } + + + + + console.log(msg); } -- libgit2 0.21.2