mirror of
https://git.stamm.me/OpenServer/NodeLogging.git
synced 2024-11-15 04:41:03 +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() {
|
function _getCallerFile() {
|
||||||
try {
|
try {
|
||||||
var err = new Error();
|
var err = new Error();
|
||||||
var callerfile;
|
var caller_file;
|
||||||
var currentfile;
|
var current_file;
|
||||||
Error.prepareStackTrace = function (err, stack) { return stack; };
|
Error.prepareStackTrace = function (err, stack) { return stack; };
|
||||||
currentfile = err.stack.shift().getFileName();
|
current_file = err.stack.shift().getFileName();
|
||||||
while (err.stack.length) {
|
while (err.stack.length) {
|
||||||
callerfile = err.stack.shift().getFileName();
|
caller_file = err.stack.shift().getFileName();
|
||||||
if (currentfile !== callerfile)
|
if (current_file !== caller_file) {
|
||||||
return callerfile;
|
let array = caller_file.split("/");
|
||||||
|
return array[array.length - 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) { }
|
catch (err) { }
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "logger-perfcloud",
|
"name": "logger-perfcloud",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "out/index.js",
|
"main": "out/index.js",
|
||||||
"types": "out/index.d.ts",
|
"types": "out/index.d.ts",
|
||||||
|
13
src/index.ts
13
src/index.ts
@ -180,17 +180,20 @@ export class Logging {
|
|||||||
function _getCallerFile() {
|
function _getCallerFile() {
|
||||||
try {
|
try {
|
||||||
var err = new Error();
|
var err = new Error();
|
||||||
var callerfile;
|
var caller_file: string;
|
||||||
var currentfile;
|
var current_file: string;
|
||||||
|
|
||||||
(<any>Error).prepareStackTrace = function (err, stack) { return stack; };
|
(<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) {
|
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) { }
|
} catch (err) { }
|
||||||
return undefined;
|
return undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user