mirror of
https://git.hibas.dev/OpenServer/NodeLogging.git
synced 2025-07-02 05:01:23 +00:00
Removing long path
This commit is contained in:
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;
|
||||
|
Reference in New Issue
Block a user