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

making files in config nullabel to disable

This commit is contained in:
Fabian 2019-04-03 20:53:28 -04:00
parent 0b75f8ddf8
commit 096c5910c3
2 changed files with 17 additions and 12 deletions

View File

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

View File

@ -5,13 +5,17 @@ import { LoggingBase as LoggingBaseOriginal, LoggingBaseOptions } from "@hibas12
export interface LoggingOptions extends LoggingBaseOptions {
files: boolean | {
/**
* Filename/path of the logfile. Skip if generated with name
* Filename/path of the logfile. Skip if generated with name.
*
* If not wanted pass null
*/
logfile: string;
logfile?: string | null;
/**
* Filename/path of the logfile. Skip if generated with name
* Filename/path of the logfile. Skip if generated with name.
*
* If not wanted pass null
*/
errorfile: string;
errorfile?: string | null;
}
}
@ -25,21 +29,22 @@ export class LoggingBase extends LoggingBaseOriginal {
if (typeof config !== "string" && typeof config.files === "object") {
logfile = config.files.logfile;
errorfile = config.files.errorfile;
} else {
}
let name = this.name ? "." + this.name : "";
if (!logfile && logfile !== null)
logfile = `./logs/all${name}.log`;
if (!errorfile && errorfile !== null)
errorfile = `./logs/error${name}.log`;
}
if (logfile) {
if (logfile)
this.addAdapter(new LoggingFiles(logfile));
}
if (errorfile) {
if (errorfile)
this.addAdapter(new LoggingFiles(errorfile, true));
}
}
}
}
export let Logging: LoggingBase = undefined;