@graphql-mesh/utils 0.103.16 → 0.103.17

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/cjs/logger.js CHANGED
@@ -62,7 +62,7 @@ class DefaultLogger {
62
62
  }
63
63
  get prefix() {
64
64
  return this.name
65
- ? `${(0, exports.titleBold)(this.name.trim())} ` /* trailing space because prefix is directly used in logged message */
65
+ ? `[${(0, exports.titleBold)(this.name.toString().trim())}] ` /* trailing space because prefix is directly used in logged message */
66
66
  : ``;
67
67
  }
68
68
  /** Logs a message at {@link LogLevel.info} but without the "INFO" prefix. */
@@ -70,44 +70,44 @@ class DefaultLogger {
70
70
  if (this.logLevel > LogLevel.info) {
71
71
  return noop;
72
72
  }
73
- this.console.log(`[timestamp=${getTimestamp()}] ${this.prefix}`.trim() /* trim in case prefix is empty */, ...args);
73
+ this.console.log(`[${getTimestamp()}] ${this.prefix}`.trim() /* trim in case prefix is empty */, ...args);
74
74
  }
75
75
  warn(...args) {
76
76
  if (this.logLevel > LogLevel.warn) {
77
77
  return noop;
78
78
  }
79
- this.console.warn(`[timestamp=${getTimestamp()}] [level=WARN] ${this.prefix}${ANSI_CODES.orange}`, ...args, ANSI_CODES.reset);
79
+ this.console.warn(`[${getTimestamp()}] WARN ${this.prefix}${ANSI_CODES.orange}`, ...args, ANSI_CODES.reset);
80
80
  }
81
81
  info(...args) {
82
82
  if (this.logLevel > LogLevel.info) {
83
83
  return noop;
84
84
  }
85
- this.console.info(`[timestamp=${getTimestamp()}] [level=INFO] ${this.prefix}${ANSI_CODES.cyan}`, ...args, ANSI_CODES.reset);
85
+ this.console.info(`[${getTimestamp()}] INFO ${this.prefix}${ANSI_CODES.cyan}`, ...args, ANSI_CODES.reset);
86
86
  }
87
87
  error(...args) {
88
88
  if (this.logLevel > LogLevel.error) {
89
89
  return noop;
90
90
  }
91
- this.console.error(`[timestamp=${getTimestamp()}] [level=ERROR] ${this.prefix}${ANSI_CODES.red}`, ...args, ANSI_CODES.reset);
91
+ this.console.error(`[${getTimestamp()}] ERROR ${this.prefix}${ANSI_CODES.red}`, ...args, ANSI_CODES.reset);
92
92
  }
93
93
  debug(...lazyArgs) {
94
94
  if (this.logLevel > LogLevel.debug) {
95
95
  return noop;
96
96
  }
97
97
  const flattenedArgs = handleLazyMessage(lazyArgs);
98
- this.console.debug(`[timestamp=${getTimestamp()}] [level=DEBUG] ${this.prefix}${ANSI_CODES.magenta}`, ...flattenedArgs, ANSI_CODES.reset);
98
+ this.console.debug(`[${getTimestamp()}] DEBUG ${this.prefix}${ANSI_CODES.magenta}`, ...flattenedArgs, ANSI_CODES.reset);
99
99
  }
100
100
  child(name) {
101
101
  name = stringifyName(name);
102
102
  if (this.name?.includes(name)) {
103
103
  return this;
104
104
  }
105
- return new DefaultLogger(this.name ? `${this.name} ${name}` : name, this.logLevel, undefined, this.console);
105
+ return new DefaultLogger(this.name ? `${this.name}, ${name}` : name, this.logLevel, undefined, this.console);
106
106
  }
107
107
  addPrefix(prefix) {
108
108
  prefix = stringifyName(prefix);
109
109
  if (!this.name?.includes(prefix)) {
110
- this.name = this.name ? `${this.name} ${prefix}` : prefix;
110
+ this.name = this.name ? `${this.name}, ${prefix}` : prefix;
111
111
  }
112
112
  return this;
113
113
  }
@@ -118,11 +118,11 @@ class DefaultLogger {
118
118
  exports.DefaultLogger = DefaultLogger;
119
119
  function stringifyName(name) {
120
120
  if (typeof name === 'string' || typeof name === 'number') {
121
- return `[${name}]`;
121
+ return `${name}`;
122
122
  }
123
123
  const names = [];
124
124
  for (const [key, value] of Object.entries(name)) {
125
125
  names.push(`${key}=${value}`);
126
126
  }
127
- return `[${names.join(', ')}]`;
127
+ return `${names.join(', ')}`;
128
128
  }
package/esm/logger.js CHANGED
@@ -54,7 +54,7 @@ export class DefaultLogger {
54
54
  }
55
55
  get prefix() {
56
56
  return this.name
57
- ? `${titleBold(this.name.trim())} ` /* trailing space because prefix is directly used in logged message */
57
+ ? `[${titleBold(this.name.toString().trim())}] ` /* trailing space because prefix is directly used in logged message */
58
58
  : ``;
59
59
  }
60
60
  /** Logs a message at {@link LogLevel.info} but without the "INFO" prefix. */
@@ -62,44 +62,44 @@ export class DefaultLogger {
62
62
  if (this.logLevel > LogLevel.info) {
63
63
  return noop;
64
64
  }
65
- this.console.log(`[timestamp=${getTimestamp()}] ${this.prefix}`.trim() /* trim in case prefix is empty */, ...args);
65
+ this.console.log(`[${getTimestamp()}] ${this.prefix}`.trim() /* trim in case prefix is empty */, ...args);
66
66
  }
67
67
  warn(...args) {
68
68
  if (this.logLevel > LogLevel.warn) {
69
69
  return noop;
70
70
  }
71
- this.console.warn(`[timestamp=${getTimestamp()}] [level=WARN] ${this.prefix}${ANSI_CODES.orange}`, ...args, ANSI_CODES.reset);
71
+ this.console.warn(`[${getTimestamp()}] WARN ${this.prefix}${ANSI_CODES.orange}`, ...args, ANSI_CODES.reset);
72
72
  }
73
73
  info(...args) {
74
74
  if (this.logLevel > LogLevel.info) {
75
75
  return noop;
76
76
  }
77
- this.console.info(`[timestamp=${getTimestamp()}] [level=INFO] ${this.prefix}${ANSI_CODES.cyan}`, ...args, ANSI_CODES.reset);
77
+ this.console.info(`[${getTimestamp()}] INFO ${this.prefix}${ANSI_CODES.cyan}`, ...args, ANSI_CODES.reset);
78
78
  }
79
79
  error(...args) {
80
80
  if (this.logLevel > LogLevel.error) {
81
81
  return noop;
82
82
  }
83
- this.console.error(`[timestamp=${getTimestamp()}] [level=ERROR] ${this.prefix}${ANSI_CODES.red}`, ...args, ANSI_CODES.reset);
83
+ this.console.error(`[${getTimestamp()}] ERROR ${this.prefix}${ANSI_CODES.red}`, ...args, ANSI_CODES.reset);
84
84
  }
85
85
  debug(...lazyArgs) {
86
86
  if (this.logLevel > LogLevel.debug) {
87
87
  return noop;
88
88
  }
89
89
  const flattenedArgs = handleLazyMessage(lazyArgs);
90
- this.console.debug(`[timestamp=${getTimestamp()}] [level=DEBUG] ${this.prefix}${ANSI_CODES.magenta}`, ...flattenedArgs, ANSI_CODES.reset);
90
+ this.console.debug(`[${getTimestamp()}] DEBUG ${this.prefix}${ANSI_CODES.magenta}`, ...flattenedArgs, ANSI_CODES.reset);
91
91
  }
92
92
  child(name) {
93
93
  name = stringifyName(name);
94
94
  if (this.name?.includes(name)) {
95
95
  return this;
96
96
  }
97
- return new DefaultLogger(this.name ? `${this.name} ${name}` : name, this.logLevel, undefined, this.console);
97
+ return new DefaultLogger(this.name ? `${this.name}, ${name}` : name, this.logLevel, undefined, this.console);
98
98
  }
99
99
  addPrefix(prefix) {
100
100
  prefix = stringifyName(prefix);
101
101
  if (!this.name?.includes(prefix)) {
102
- this.name = this.name ? `${this.name} ${prefix}` : prefix;
102
+ this.name = this.name ? `${this.name}, ${prefix}` : prefix;
103
103
  }
104
104
  return this;
105
105
  }
@@ -109,11 +109,11 @@ export class DefaultLogger {
109
109
  }
110
110
  function stringifyName(name) {
111
111
  if (typeof name === 'string' || typeof name === 'number') {
112
- return `[${name}]`;
112
+ return `${name}`;
113
113
  }
114
114
  const names = [];
115
115
  for (const [key, value] of Object.entries(name)) {
116
116
  names.push(`${key}=${value}`);
117
117
  }
118
- return `[${names.join(', ')}]`;
118
+ return `${names.join(', ')}`;
119
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/utils",
3
- "version": "0.103.16",
3
+ "version": "0.103.17",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "*"
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@graphql-mesh/cross-helpers": "^0.4.10",
10
10
  "@graphql-mesh/string-interpolation": "^0.5.8",
11
- "@graphql-mesh/types": "^0.103.16",
11
+ "@graphql-mesh/types": "^0.103.17",
12
12
  "@graphql-tools/batch-delegate": "^9.0.16",
13
13
  "@graphql-tools/delegate": "^10.0.28",
14
14
  "@graphql-tools/utils": "^10.8.0",