@ncoderz/log-m8
Advanced tools
+1
-1
| { | ||
| "name": "@ncoderz/log-m8", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "Logging system for TypeScript / JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "RA Sewell <richard.sewell@ncoderz.com>", |
+37
-18
| # log-m8 | ||
| A flexible, extensible logging system for TypeScript and JavaScript applications. | ||
|  | ||
|  | ||
|  | ||
| [](LICENSE) | ||
| [](https://www.npmjs.com/package/log-m8) | ||
| A fast, small, flexible and extensible logging system for TypeScript and JavaScript applications. | ||
| ## Features | ||
@@ -22,3 +25,3 @@ | ||
| ```bash | ||
| npm install log-m8 | ||
| npm install @ncoderz/log-m8 | ||
| ``` | ||
@@ -29,3 +32,3 @@ | ||
| ```typescript | ||
| import { LogM8 } from 'log-m8'; | ||
| import { LogM8 } from '@ncoderz/log-m8'; | ||
@@ -165,2 +168,14 @@ // Configure the logging system | ||
| ### Supported Formatter Tokens | ||
| - `{timestamp}`: Formatted timestamp | ||
| - `{LEVEL}`: Uppercase level label (with optional colorization) | ||
| - `{level}`: Lowercase level name | ||
| - `{logger}`: Logger name | ||
| - `{message}`: Primary log message | ||
| - `{data}`: Additional data arguments | ||
| - `{context.*}`: Nested context properties | ||
| All tokens support accessing nested items with `data[0].property` like notation. | ||
| ### Built-in Formatters | ||
@@ -176,3 +191,3 @@ | ||
| // Optional: custom format with token placeholders | ||
| format: '{timestamp} {LEVEL} [{logger}] {message} {data}', | ||
| format: ['{timestamp} {LEVEL} [{logger}]', '{message}', '{data}'], | ||
| // Optional: timestamp format ('iso', 'locale', or custom pattern) | ||
@@ -185,10 +200,2 @@ timestampFormat: 'hh:mm:ss.SSS', | ||
| Supported tokens: | ||
| - `{timestamp}`: Formatted timestamp | ||
| - `{LEVEL}`: Uppercase level label (with optional colorization) | ||
| - `{level}`: Lowercase level name | ||
| - `{logger}`: Logger name | ||
| - `{message}`: Primary log message | ||
| - `{data}`: Additional data arguments | ||
| - `{context.*}`: Nested context properties | ||
@@ -203,3 +210,5 @@ #### JSON Formatter | ||
| // Optional fields to include | ||
| fields: ['timestamp', 'level', 'logger', 'message', 'data', 'context'] | ||
| format: ['timestamp', 'level', 'logger', 'message', 'data', 'context'], | ||
| // Pretty print | ||
| pretty: true | ||
| } | ||
@@ -212,2 +221,6 @@ ``` | ||
| ### Supported Filter Tokens | ||
| See Supported Formatter Tokens. | ||
| ### Built-in Filters | ||
@@ -246,7 +259,11 @@ | ||
| // Flush all appenders | ||
| LogM8.flushAppenders(); | ||
| // Disable a filter for a specific appender | ||
| LogM8.disableFilter('sensitive-data', 'console'); | ||
| // Flush all appenders | ||
| LogM8.flushAppenders(); | ||
| // Enable a filter for a specific appender | ||
| LogM8.enableFilter('sensitive-data', 'console'); | ||
| ``` | ||
@@ -256,4 +273,6 @@ | ||
| You can extend log-m8 with custom appenders, formatters, and filters: | ||
| You can extend log-m8 with custom appenders, formatters, and filters. | ||
| For example: | ||
| ```typescript | ||
@@ -260,0 +279,0 @@ class SlackAppenderFactory implements PluginFactory { |
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
514221
0.08%316
6.4%