http-system-logger 1.0.7 → 1.0.9

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/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export declare class Logger {
2
- private readonly context;
2
+ private context;
3
3
  private readonly logger;
4
4
  constructor(context: string);
5
+ setContext(context: string): void;
5
6
  info(message: string, context?: string): void;
6
7
  error(message: string, trace?: string, context?: string): void;
7
8
  warn(message: string, context?: string): void;
package/dist/index.js CHANGED
@@ -10,6 +10,9 @@ class Logger {
10
10
  this.context = context;
11
11
  this.logger = (0, winston_config_1.getLogger)();
12
12
  }
13
+ setContext(context) {
14
+ this.context = context;
15
+ }
13
16
  info(message, context) {
14
17
  this.logger.info(message, { context: context || this.context });
15
18
  }
@@ -33,7 +33,13 @@ const ignoredRoutes = (process.env.IGNORED_ROUTES || '/api/health')
33
33
  .split(',')
34
34
  .map((route) => route.trim()); // Load ignored routes from environment variables
35
35
  const morganMiddleware = (0, morgan_1.default)(function (tokens, req, res) {
36
- if (ignoredRoutes.includes(req.path)) {
36
+ if (ignoredRoutes.some(route => {
37
+ if (!route.includes('*')) {
38
+ return req.path === route; // Exact match for non-wildcard routes
39
+ }
40
+ const regex = new RegExp(route.replace('*', '.*'));
41
+ return regex.test(req.path);
42
+ })) {
37
43
  return null; // Skip logging for ignored routes
38
44
  }
39
45
  return JSON.stringify({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "http-system-logger",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "A lightweight and configurable logging library for Node.js applications, built with winston and morgan.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",