mirror of
https://git.stamm.me/OpenServer/NodeLogging.git
synced 2024-11-14 17:21:04 +00:00
making files in config nullabel to disable
This commit is contained in:
parent
0b75f8ddf8
commit
096c5910c3
@ -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",
|
||||
|
27
src/index.ts
27
src/index.ts
@ -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,19 +29,20 @@ 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 : "";
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user