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:
parent
a649e758d5
commit
cec4cf158a
14
out/index.js
14
out/index.js
@ -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
@ -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",
|
||||
|
13
src/index.ts
13
src/index.ts
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user