azify-logger 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +5 -1
- package/index.js +8 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -62,8 +62,12 @@ export function createAzifyLogger(options?: {
|
|
|
62
62
|
}): AzifyLogger;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Creates a new AzifyLogger instance using environment variables
|
|
65
|
+
* Creates a new AzifyLogger instance using environment variables and automatically intercepts console
|
|
66
66
|
* @returns New AzifyLogger instance configured from environment
|
|
67
|
+
* @example
|
|
68
|
+
* const logger = createAzifyLoggerFromEnv();
|
|
69
|
+
* logger.info('Hello world');
|
|
70
|
+
* console.log('This will also appear in OpenSearch!');
|
|
67
71
|
*/
|
|
68
72
|
export function createAzifyLoggerFromEnv(): AzifyLogger;
|
|
69
73
|
|
package/index.js
CHANGED
|
@@ -148,18 +148,24 @@ function createAzifyLogger(options = {}) {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
|
-
* Creates a new AzifyLogger instance using environment variables
|
|
151
|
+
* Creates a new AzifyLogger instance using environment variables and automatically intercepts console
|
|
152
152
|
* @returns {AzifyLogger} New AzifyLogger instance configured from environment
|
|
153
153
|
* @example
|
|
154
154
|
* const logger = createAzifyLoggerFromEnv();
|
|
155
155
|
* logger.info('Hello world');
|
|
156
|
+
* console.log('This will also appear in OpenSearch!');
|
|
156
157
|
*/
|
|
157
158
|
function createAzifyLoggerFromEnv() {
|
|
158
|
-
|
|
159
|
+
const logger = createAzifyLogger({
|
|
159
160
|
serviceName: process.env.APP_NAME || 'azipay',
|
|
160
161
|
loggerUrl: process.env.AZIFY_LOGGER_URL || 'http://localhost:3001',
|
|
161
162
|
environment: process.env.NODE_ENV || 'development'
|
|
162
163
|
})
|
|
164
|
+
|
|
165
|
+
// Automatically intercept console methods
|
|
166
|
+
interceptConsole(logger)
|
|
167
|
+
|
|
168
|
+
return logger
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
/**
|