@ncoderz/log-m8
Advanced tools
+20
-2
@@ -596,2 +596,3 @@ "use strict"; | ||
| __publicField(this, "_stream"); | ||
| __publicField(this, "_streamCreationFailed", false); | ||
| } | ||
@@ -602,11 +603,24 @@ init(config, formatter, filters) { | ||
| this._filters = filters || []; | ||
| const flags = this._config.append ? "a" : "w"; | ||
| this._stream = (0, import_fs.createWriteStream)(this._config.filename ?? DEFAULT_FILENAME, { flags }); | ||
| this.enabled = this._config?.enabled !== false; | ||
| this.priority = this._config?.priority; | ||
| if (this.enabled) { | ||
| this._createStream(); | ||
| } | ||
| } | ||
| dispose() { | ||
| this._stream?.end(); | ||
| this._stream = void 0; | ||
| } | ||
| write(event) { | ||
| if (this._streamCreationFailed) return; | ||
| if (!this._stream) { | ||
| try { | ||
| this._createStream(); | ||
| } catch (err) { | ||
| if (console && console.error) { | ||
| console.error(`LogM8 [FileAppender]: Failed to create file stream: ${err}`); | ||
| } | ||
| this._streamCreationFailed = true; | ||
| } | ||
| } | ||
| if (!this._stream) return; | ||
@@ -640,2 +654,6 @@ for (const filter of this._filters) { | ||
| } | ||
| _createStream() { | ||
| const flags = this._config?.append ? "a" : "w"; | ||
| this._stream = (0, import_fs.createWriteStream)(this._config?.filename ?? DEFAULT_FILENAME, { flags }); | ||
| } | ||
| }; | ||
@@ -642,0 +660,0 @@ var FileAppenderFactory = class { |
+20
-2
@@ -569,2 +569,3 @@ var __defProp = Object.defineProperty; | ||
| __publicField(this, "_stream"); | ||
| __publicField(this, "_streamCreationFailed", false); | ||
| } | ||
@@ -575,11 +576,24 @@ init(config, formatter, filters) { | ||
| this._filters = filters || []; | ||
| const flags = this._config.append ? "a" : "w"; | ||
| this._stream = createWriteStream(this._config.filename ?? DEFAULT_FILENAME, { flags }); | ||
| this.enabled = this._config?.enabled !== false; | ||
| this.priority = this._config?.priority; | ||
| if (this.enabled) { | ||
| this._createStream(); | ||
| } | ||
| } | ||
| dispose() { | ||
| this._stream?.end(); | ||
| this._stream = void 0; | ||
| } | ||
| write(event) { | ||
| if (this._streamCreationFailed) return; | ||
| if (!this._stream) { | ||
| try { | ||
| this._createStream(); | ||
| } catch (err) { | ||
| if (console && console.error) { | ||
| console.error(`LogM8 [FileAppender]: Failed to create file stream: ${err}`); | ||
| } | ||
| this._streamCreationFailed = true; | ||
| } | ||
| } | ||
| if (!this._stream) return; | ||
@@ -613,2 +627,6 @@ for (const filter of this._filters) { | ||
| } | ||
| _createStream() { | ||
| const flags = this._config?.append ? "a" : "w"; | ||
| this._stream = createWriteStream(this._config?.filename ?? DEFAULT_FILENAME, { flags }); | ||
| } | ||
| }; | ||
@@ -615,0 +633,0 @@ var FileAppenderFactory = class { |
+1
-1
| { | ||
| "name": "@ncoderz/log-m8", | ||
| "version": "1.2.2", | ||
| "version": "1.2.3", | ||
| "description": "Logging system for TypeScript / JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "RA Sewell <richard.sewell@ncoderz.com>", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
540714
0.54%4260
0.85%