1
0
mirror of https://git.stamm.me/OpenServer/NodeLogging.git synced 2024-12-23 04:09:24 +00:00

Removing long path

This commit is contained in:
Fabian Stamm 2017-10-21 12:36:18 +02:00
parent a649e758d5
commit cec4cf158a
4 changed files with 18 additions and 13 deletions

View File

@ -174,14 +174,16 @@ exports.Logging = Logging;
function _getCallerFile() {
try {
var err = new Error();
var callerfile;
var currentfile;
var caller_file;
var current_file;
Error.prepareStackTrace = function (err, stack) { return stack; };
currentfile = err.stack.shift().getFileName();
current_file = err.stack.shift().getFileName();
while (err.stack.length) {
callerfile = err.stack.shift().getFileName();
if (currentfile !== callerfile)
return callerfile;
caller_file = err.stack.shift().getFileName();
if (current_file !== caller_file) {
let array = caller_file.split("/");
return array[array.length - 1];
}
}
}
catch (err) { }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "logger-perfcloud",
"version": "1.0.3",
"version": "1.0.4",
"description": "",
"main": "out/index.js",
"types": "out/index.d.ts",

View File

@ -180,17 +180,20 @@ export class Logging {
function _getCallerFile() {
try {
var err = new Error();
var callerfile;
var currentfile;
var caller_file: string;
var current_file: string;
(<any>Error).prepareStackTrace = function (err, stack) { return stack; };
currentfile = (<any>err.stack).shift().getFileName();
current_file = (<any>err.stack).shift().getFileName();
while (err.stack.length) {
callerfile = (<any>err.stack).shift().getFileName();
caller_file = (<any>err.stack).shift().getFileName();
if (currentfile !== callerfile) return callerfile;
if (current_file !== caller_file) {
let array = caller_file.split("/")
return array[array.length - 1];
}
}
} catch (err) { }
return undefined;