@onlineapps/infrastructure-tools 1.0.2 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/infrastructure-tools",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Infrastructure orchestration utilities for OA Drive infrastructure services (health tracking, queue initialization, service discovery)",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -43,19 +43,26 @@ async function waitForInfrastructureReady(options = {}) {
43
43
  const logger = options.logger || console;
44
44
 
45
45
  // Universal logger adapter (supports both console and winston)
46
- // Winston logger expects object with message property, console.log accepts string
46
+ // Winston logger can accept string, but to be safe, we'll always use object format for winston
47
47
  const log = (message) => {
48
- if (typeof logger.info === 'function' && typeof logger.log !== 'function') {
49
- // Likely winston logger - use object format
50
- logger.info({ message: String(message) });
48
+ const messageStr = String(message);
49
+
50
+ // Check if logger is winston (has child method or format property)
51
+ const isWinston = typeof logger.child === 'function' || logger.format !== undefined;
52
+
53
+ if (typeof logger.info === 'function') {
54
+ if (isWinston) {
55
+ // Winston logger - always use object format to avoid property conflicts
56
+ logger.info({ message: messageStr });
57
+ } else {
58
+ // Other logger with info method - use string
59
+ logger.info(messageStr);
60
+ }
51
61
  } else if (typeof logger.log === 'function') {
52
62
  // console.log or similar
53
- logger.log(message);
54
- } else if (typeof logger.info === 'function') {
55
- // Fallback for other loggers
56
- logger.info(message);
63
+ logger.log(messageStr);
57
64
  } else {
58
- console.log(message);
65
+ console.log(messageStr);
59
66
  }
60
67
  };
61
68