1
0
mirror of https://git.stamm.me/OpenServer/NodeLogging.git synced 2024-11-25 00:39:24 +00:00

Changing error output a bit.

This commit is contained in:
Fabian Stamm 2018-07-01 13:05:34 +02:00
parent 34817704ca
commit dfd9356423
4 changed files with 10 additions and 12 deletions

2
out/index.d.ts vendored
View File

@ -16,7 +16,7 @@ export declare class Logging {
static warning(...message: any[]): void; static warning(...message: any[]): void;
static logWithCustomColors(type: LoggingTypes, colors: string, ...message: any[]): void; static logWithCustomColors(type: LoggingTypes, colors: string, ...message: any[]): void;
static error(error: Error | string): void; static error(error: Error | string): void;
static errorMessage(...message: string[]): void; static errorMessage(...message: any[]): void;
private static message(type, message, customColors?); private static message(type, message, customColors?);
private static writeMessageToFile(message, error?); private static writeMessageToFile(message, error?);
private static checkQueue(); private static checkQueue();

View File

@ -49,11 +49,11 @@ class Logging {
static error(error) { static error(error) {
if (typeof error === "string") { if (typeof error === "string") {
let e = new Error(); let e = new Error();
Logging.errorMessage(error + e.stack); Logging.message(LoggingTypes.Error, [error, ":", e.stack]);
return; }
else {
Logging.message(LoggingTypes.Error, [error.name, ":", error.message, ":", error.stack]);
} }
var message = error.name + " " + error.message + "\n" + error.stack;
Logging.message(LoggingTypes.Error, [message]);
} }
static errorMessage(...message) { static errorMessage(...message) {
Logging.message(LoggingTypes.Error, message); Logging.message(LoggingTypes.Error, message);

File diff suppressed because one or more lines are too long

View File

@ -71,15 +71,13 @@ export class Logging {
static error(error: Error | string) { static error(error: Error | string) {
if (typeof error === "string") { if (typeof error === "string") {
let e = new Error() let e = new Error()
Logging.errorMessage(error + e.stack); Logging.message(LoggingTypes.Error, [error, ":", e.stack]);
return; } else {
Logging.message(LoggingTypes.Error, [error.name, ":", error.message, ":", error.stack]);
} }
var message = error.name + " " + error.message + "\n" + error.stack;
Logging.message(LoggingTypes.Error, [message]);
} }
static errorMessage(...message: string[]) { static errorMessage(...message: any[]) {
Logging.message(LoggingTypes.Error, message); Logging.message(LoggingTypes.Error, message);
} }