mirror of
				https://git.hibas.dev/OpenServer/NodeLogging.git
				synced 2025-10-31 05:30:45 +00:00 
			
		
		
		
	making files in config nullabel to disable
This commit is contained in:
		| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|    "name": "@hibas123/nodelogging", |    "name": "@hibas123/nodelogging", | ||||||
|    "version": "1.6.0", |    "version": "1.6.1", | ||||||
|    "description": "", |    "description": "", | ||||||
|    "main": "out/index.js", |    "main": "out/index.js", | ||||||
|    "types": "out/index.d.ts", |    "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 { | export interface LoggingOptions extends LoggingBaseOptions { | ||||||
|    files: boolean | { |    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") { |          if (typeof config !== "string" && typeof config.files === "object") { | ||||||
|             logfile = config.files.logfile; |             logfile = config.files.logfile; | ||||||
|             errorfile = config.files.errorfile; |             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`; |             logfile = `./logs/all${name}.log`; | ||||||
|  |          if (!errorfile && errorfile !== null) | ||||||
|             errorfile = `./logs/error${name}.log`; |             errorfile = `./logs/error${name}.log`; | ||||||
|          } |  | ||||||
|  |  | ||||||
|          if (logfile) { |          if (logfile) | ||||||
|             this.addAdapter(new LoggingFiles(logfile)); |             this.addAdapter(new LoggingFiles(logfile)); | ||||||
|          } |  | ||||||
|  |  | ||||||
|          if (errorfile) { |  | ||||||
|  |          if (errorfile) | ||||||
|             this.addAdapter(new LoggingFiles(errorfile, true)); |             this.addAdapter(new LoggingFiles(errorfile, true)); | ||||||
|          } |  | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Fabian
					Fabian