1
0
mirror of https://git.stamm.me/OpenServer/NodeLogging.git synced 2024-11-22 06:59:23 +00:00

Adding underscore and minus to stack parser

This commit is contained in:
Fabian Stamm 2018-09-20 18:30:21 +02:00
parent 7d5404a370
commit 3f035ad1b9
7 changed files with 35 additions and 17 deletions

27
out/index.d.ts vendored
View File

@ -27,11 +27,20 @@ export declare const Colors: {
};
export interface LoggingBaseOptions {
/**
* Name will be prefixed on Console output
* Name will be prefixed on Console output and added to logfiles, if not specified here
*/
name: string;
/**
* Filename/path of the logfile. Skip if generated with name
*/
logfile: string;
/**
* Filename/path of the logfile. Skip if generated with name
*/
errorfile: string;
/**
* Prints output to console
*/
console_out: boolean;
}
export declare class LoggingBase {
@ -45,7 +54,7 @@ export declare class LoggingBase {
constructor(options?: Partial<LoggingBaseOptions>);
console_out: boolean;
waitForSetup(): Promise<void>;
private setup;
private setup();
events: EventEmitter;
debug(...message: any[]): void;
log(...message: any[]): void;
@ -53,12 +62,12 @@ export declare class LoggingBase {
logWithCustomColors(type: LoggingTypes, colors: string, ...message: any[]): void;
error(error: Error | string): void;
errorMessage(...message: any[]): void;
private message;
private writeMessageToFile;
private checkQueue;
private writeToLogFile;
private writeToErrorFile;
private initializeFile;
private message(type, message, customColors?, caller?);
private writeMessageToFile(message, error?);
private checkQueue();
private writeToLogFile(data);
private writeToErrorFile(data);
private initializeFile(file, new_file?);
}
export declare const Logging: LoggingBase;
export default Logging;
@ -66,5 +75,5 @@ export declare enum LoggingTypes {
Log = 0,
Warning = 1,
Error = 2,
Debug = 3
Debug = 3,
}

View File

@ -354,7 +354,7 @@ function getCallerFromExisting(err) {
lines.shift(); // removing first line
while (lines.length > 0) {
let line = lines.shift();
let matches = line.match(/[a-zA-Z]+[.][a-zA-Z]+[:][0-9]+/g);
let matches = line.match(/[a-zA-Z_-]+[.][a-zA-Z_-]+[:][0-9]+/g);
if (matches && matches.length > 0) {
let [f, line] = matches[0].split(":");
if (f != current) {

File diff suppressed because one or more lines are too long

4
out/lock.d.ts vendored
View File

@ -7,6 +7,6 @@ export default class Lock {
private toCome;
constructor();
getLock(): Promise<Release>;
private lock;
private release;
private lock();
private release();
}

View File

@ -1 +1 @@
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":";;AACA,MAAqB,IAAI;IAOtB;QANQ,YAAO,GAAY,KAAK,CAAC;QAIzB,WAAM,GAAmB,EAAE,CAAC;QAGjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAPD,IAAI,MAAM;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAOD,KAAK,CAAC,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;aAC9C;YACF,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,EAAE;gBACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;oBACnB,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACrC,CAAC,CAAC,CAAA;YACL,CAAC,CAAC,CAAA;SACJ;IACJ,CAAC;IAEO,IAAI;QACT,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,OAAO;QAClB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;SACxB;aAAM;YACJ,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACvB;IACJ,CAAC;CACH;AAlCD,uBAkCC"}
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":";;AACA;IAOG;QANQ,YAAO,GAAY,KAAK,CAAC;QAIzB,WAAM,GAAmB,EAAE,CAAC;QAGjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAPD,IAAI,MAAM;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAOD,KAAK,CAAC,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;aAC9C;YACF,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,EAAE;gBACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;oBACnB,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACrC,CAAC,CAAC,CAAA;YACL,CAAC,CAAC,CAAA;SACJ;IACJ,CAAC;IAEO,IAAI;QACT,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,OAAO;QAClB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;SACxB;aAAM;YACJ,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACvB;IACJ,CAAC;CACH;AAlCD,uBAkCC"}

View File

@ -1,6 +1,6 @@
{
"name": "@hibas123/nodelogging",
"version": "1.3.9",
"version": "1.3.10",
"description": "",
"main": "out/index.js",
"types": "out/index.d.ts",

View File

@ -38,11 +38,20 @@ const OriginalErrorStackFunction = (<any>Error.prototype).prepareStackTrace
export interface LoggingBaseOptions {
/**
* Name will be prefixed on Console output
* Name will be prefixed on Console output and added to logfiles, if not specified here
*/
name: string,
/**
* Filename/path of the logfile. Skip if generated with name
*/
logfile: string;
/**
* Filename/path of the logfile. Skip if generated with name
*/
errorfile: string;
/**
* Prints output to console
*/
console_out: boolean;
}
@ -392,7 +401,7 @@ function getCallerFromExisting(err: Error): { file: string, line: number } {
lines.shift();// removing first line
while (lines.length > 0) {
let line = lines.shift();
let matches = line.match(/[a-zA-Z]+[.][a-zA-Z]+[:][0-9]+/g)
let matches = line.match(/[a-zA-Z_-]+[.][a-zA-Z_-]+[:][0-9]+/g)
if (matches && matches.length > 0) {
let [f, line] = matches[0].split(":")
if (f != current) {