@sap-ux/fiori-generator-shared 0.7.28 → 0.8.0
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Log, Logger as SapUxLogger, Transport } from '@sap-ux/logger';
|
|
2
|
+
import type { IChildLogger as ILogWrapper, IVSCodeExtLogger, LogLevel } from '@vscode-logging/logger';
|
|
2
3
|
import type { Logger } from 'yeoman-environment';
|
|
3
4
|
export type { ILogWrapper };
|
|
4
5
|
export declare const LOGGING_LEVEL_CONFIG_PROP = "ApplicationWizard.loggingLevel";
|
|
@@ -19,9 +20,9 @@ export declare function createCLILogger(logName: string, logLevel?: LogLevel): I
|
|
|
19
20
|
/**
|
|
20
21
|
* Log to vscode extension logger and yeoman logger simultaneously.
|
|
21
22
|
* This allows use of Application Wizard log config and log file use but still have a single output channel for
|
|
22
|
-
*
|
|
23
|
+
* generator logging.
|
|
23
24
|
*/
|
|
24
|
-
export declare class LogWrapper implements ILogWrapper {
|
|
25
|
+
export declare class LogWrapper implements ILogWrapper, SapUxLogger {
|
|
25
26
|
private static _vscodeLogger;
|
|
26
27
|
private static _yoLogger;
|
|
27
28
|
private static _logLevel;
|
|
@@ -36,7 +37,7 @@ export declare class LogWrapper implements ILogWrapper {
|
|
|
36
37
|
* @param vscode - vscode instance
|
|
37
38
|
*/
|
|
38
39
|
constructor(logName: string, yoLogger?: Logger, logLevel?: LogLevel, extLogger?: IVSCodeExtLogger, vscode?: any);
|
|
39
|
-
static readonly logAtLevel: (level: LogLevel, message: string, ...args: any[]) => void;
|
|
40
|
+
static readonly logAtLevel: (level: LogLevel, message: string | object, ...args: any[]) => void;
|
|
40
41
|
/**
|
|
41
42
|
* Log a message at the fatal level.
|
|
42
43
|
*
|
|
@@ -50,28 +51,28 @@ export declare class LogWrapper implements ILogWrapper {
|
|
|
50
51
|
* @param msg - message to log
|
|
51
52
|
* @param {...any} args - additional arguments
|
|
52
53
|
*/
|
|
53
|
-
error(msg: string, ...args: any[]): void;
|
|
54
|
+
error(msg: string | object, ...args: any[]): void;
|
|
54
55
|
/**
|
|
55
56
|
* Log a message at the warn level.
|
|
56
57
|
*
|
|
57
58
|
* @param msg - message to log
|
|
58
59
|
* @param {...any} args - additional arguments
|
|
59
60
|
*/
|
|
60
|
-
warn(msg: string, ...args: any[]): void;
|
|
61
|
+
warn(msg: string | object, ...args: any[]): void;
|
|
61
62
|
/**
|
|
62
63
|
* Log a message at the info level.
|
|
63
64
|
*
|
|
64
65
|
* @param msg - message to log
|
|
65
66
|
* @param {...any} args - additional arguments
|
|
66
67
|
*/
|
|
67
|
-
info(msg: string, ...args: any[]): void;
|
|
68
|
+
info(msg: string | object, ...args: any[]): void;
|
|
68
69
|
/**
|
|
69
70
|
* Log a message at the debug level.
|
|
70
71
|
*
|
|
71
72
|
* @param msg - message to log
|
|
72
73
|
* @param {...any} args - additional arguments
|
|
73
74
|
*/
|
|
74
|
-
debug(msg: string, ...args: any[]): void;
|
|
75
|
+
debug(msg: string | object, ...args: any[]): void;
|
|
75
76
|
/**
|
|
76
77
|
* Log a message at the trace level.
|
|
77
78
|
*
|
|
@@ -84,13 +85,48 @@ export declare class LogWrapper implements ILogWrapper {
|
|
|
84
85
|
*
|
|
85
86
|
* @param msg - message to log
|
|
86
87
|
*/
|
|
87
|
-
static log(msg: string): void;
|
|
88
|
+
static log(msg: string | object): void;
|
|
88
89
|
/**
|
|
89
90
|
* Get the currently configured log level.
|
|
90
91
|
*
|
|
91
92
|
* @returns {LogLevel} The current log level.
|
|
92
93
|
*/
|
|
93
94
|
getLogLevel(): LogLevel;
|
|
95
|
+
/**
|
|
96
|
+
* Not implemented method, added to support limited interoperability with @sap-ux/logger.
|
|
97
|
+
*
|
|
98
|
+
* @returns {ILogWrapper} - the current logger
|
|
99
|
+
*/
|
|
94
100
|
getChildLogger(): ILogWrapper;
|
|
101
|
+
/**
|
|
102
|
+
* Limited compatibility with `@sap-ux/logger` to use log() method.
|
|
103
|
+
*
|
|
104
|
+
* @param data
|
|
105
|
+
*/
|
|
106
|
+
log(data: string | Log): void;
|
|
107
|
+
/**
|
|
108
|
+
* Not implemented method, added to support limited interoperability with @sap-ux/logger.
|
|
109
|
+
*
|
|
110
|
+
* @returns {ILogWrapper} - the current logger
|
|
111
|
+
*/
|
|
112
|
+
add(): SapUxLogger;
|
|
113
|
+
/**
|
|
114
|
+
* Not implemented method, added to support limited interoperability with @sap-ux/logger.
|
|
115
|
+
*
|
|
116
|
+
* @returns {ILogWrapper} - the current logger
|
|
117
|
+
*/
|
|
118
|
+
remove(): SapUxLogger;
|
|
119
|
+
/**
|
|
120
|
+
* Added to support limited interoperability with @sap-ux/logger.
|
|
121
|
+
*
|
|
122
|
+
* @returns {ILogWrapper} - the current logger transports
|
|
123
|
+
*/
|
|
124
|
+
transports(): Transport[];
|
|
125
|
+
/**
|
|
126
|
+
* Not implemented method, added to support limited interoperability with @sap-ux/logger.
|
|
127
|
+
*
|
|
128
|
+
* @returns {ILogWrapper} - the current logger
|
|
129
|
+
*/
|
|
130
|
+
child(): SapUxLogger;
|
|
95
131
|
}
|
|
96
132
|
//# sourceMappingURL=logWrapper.d.ts.map
|
|
@@ -30,7 +30,31 @@ exports.DefaultLogger = {
|
|
|
30
30
|
console.trace(msg);
|
|
31
31
|
},
|
|
32
32
|
getChildLogger: () => exports.DefaultLogger,
|
|
33
|
-
getLogLevel: () => 'off'
|
|
33
|
+
getLogLevel: () => 'off',
|
|
34
|
+
/**
|
|
35
|
+
* Limited compatibility with `@sap-ux/logger`
|
|
36
|
+
*
|
|
37
|
+
* @param data
|
|
38
|
+
*/
|
|
39
|
+
log: function (data) {
|
|
40
|
+
console.log(data instanceof Object ? data.message : data);
|
|
41
|
+
},
|
|
42
|
+
add: function () {
|
|
43
|
+
console.warn('Log method `add(transport)` not implemented.');
|
|
44
|
+
return this;
|
|
45
|
+
},
|
|
46
|
+
remove: function () {
|
|
47
|
+
console.warn('Log method `remove(transport)` not implemented.');
|
|
48
|
+
return this;
|
|
49
|
+
},
|
|
50
|
+
transports: function () {
|
|
51
|
+
console.warn('Logger method `transports()` not implemented.');
|
|
52
|
+
return [];
|
|
53
|
+
},
|
|
54
|
+
child: function () {
|
|
55
|
+
console.warn('Log method `remove(transport)` not implemented. Returning current logger.');
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
34
58
|
};
|
|
35
59
|
const LOG_LEVEL_KEYS = {
|
|
36
60
|
off: -1,
|
|
@@ -60,7 +84,7 @@ function createCLILogger(logName, logLevel = 'off') {
|
|
|
60
84
|
/**
|
|
61
85
|
* Log to vscode extension logger and yeoman logger simultaneously.
|
|
62
86
|
* This allows use of Application Wizard log config and log file use but still have a single output channel for
|
|
63
|
-
*
|
|
87
|
+
* generator logging.
|
|
64
88
|
*/
|
|
65
89
|
class LogWrapper {
|
|
66
90
|
static _vscodeLogger;
|
|
@@ -95,6 +119,9 @@ class LogWrapper {
|
|
|
95
119
|
LogWrapper._vscodeLogger?.debug((0, i18n_1.t)('debug.loggingConfigured', { logLevel: LogWrapper._logLevel }));
|
|
96
120
|
}
|
|
97
121
|
static logAtLevel = (level, message, ...args) => {
|
|
122
|
+
if (typeof message === 'object') {
|
|
123
|
+
message = JSON.stringify(message);
|
|
124
|
+
}
|
|
98
125
|
if (LogWrapper._vscodeLogger && level !== 'off') {
|
|
99
126
|
LogWrapper._vscodeLogger[level](message, ...args);
|
|
100
127
|
}
|
|
@@ -180,8 +207,59 @@ class LogWrapper {
|
|
|
180
207
|
getLogLevel() {
|
|
181
208
|
return LogWrapper._logLevel;
|
|
182
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Not implemented method, added to support limited interoperability with @sap-ux/logger.
|
|
212
|
+
*
|
|
213
|
+
* @returns {ILogWrapper} - the current logger
|
|
214
|
+
*/
|
|
183
215
|
getChildLogger( /* opts: { label: string } */) {
|
|
184
|
-
|
|
216
|
+
LogWrapper.logAtLevel(`trace`, 'Log method `getChildLogger()` not implemented. Returning current logger.');
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Limited compatibility with `@sap-ux/logger` to use log() method.
|
|
221
|
+
*
|
|
222
|
+
* @param data
|
|
223
|
+
*/
|
|
224
|
+
log(data) {
|
|
225
|
+
// LogLevel is not supported in this implementation
|
|
226
|
+
LogWrapper.logAtLevel('info', data.message ?? data);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Not implemented method, added to support limited interoperability with @sap-ux/logger.
|
|
230
|
+
*
|
|
231
|
+
* @returns {ILogWrapper} - the current logger
|
|
232
|
+
*/
|
|
233
|
+
add() {
|
|
234
|
+
LogWrapper.logAtLevel(`warn`, 'Log method `add(transport)` not implemented.');
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Not implemented method, added to support limited interoperability with @sap-ux/logger.
|
|
239
|
+
*
|
|
240
|
+
* @returns {ILogWrapper} - the current logger
|
|
241
|
+
*/
|
|
242
|
+
remove() {
|
|
243
|
+
LogWrapper.logAtLevel(`warn`, 'Log method `remove(transport)` not implemented.');
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Added to support limited interoperability with @sap-ux/logger.
|
|
248
|
+
*
|
|
249
|
+
* @returns {ILogWrapper} - the current logger transports
|
|
250
|
+
*/
|
|
251
|
+
transports() {
|
|
252
|
+
LogWrapper.logAtLevel(`warn`, 'Log method `transports()` not implemented.');
|
|
253
|
+
return [];
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Not implemented method, added to support limited interoperability with @sap-ux/logger.
|
|
257
|
+
*
|
|
258
|
+
* @returns {ILogWrapper} - the current logger
|
|
259
|
+
*/
|
|
260
|
+
child() {
|
|
261
|
+
LogWrapper.logAtLevel(`warn`, 'Log method `child(options)` not implemented. Returning current logger.');
|
|
262
|
+
return this;
|
|
185
263
|
}
|
|
186
264
|
}
|
|
187
265
|
exports.LogWrapper = LogWrapper;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fiori-generator-shared",
|
|
3
3
|
"description": "Commonly used shared functionality and types to support the fiori generator.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -25,15 +25,16 @@
|
|
|
25
25
|
"os-name": "4.0.1",
|
|
26
26
|
"semver": "7.5.4",
|
|
27
27
|
"@sap-ux/btp-utils": "1.0.1",
|
|
28
|
-
"@sap-ux/project-access": "1.29.
|
|
29
|
-
"@sap-ux/telemetry": "0.5.
|
|
28
|
+
"@sap-ux/project-access": "1.29.7",
|
|
29
|
+
"@sap-ux/telemetry": "0.5.61"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/mem-fs-editor": "7.0.1",
|
|
33
33
|
"@types/mem-fs": "1.1.2",
|
|
34
34
|
"@types/semver": "7.5.2",
|
|
35
35
|
"@types/vscode": "1.73.1",
|
|
36
|
-
"@types/yeoman-environment": "2.10.11"
|
|
36
|
+
"@types/yeoman-environment": "2.10.11",
|
|
37
|
+
"@sap-ux/logger": "0.6.0"
|
|
37
38
|
},
|
|
38
39
|
"engines": {
|
|
39
40
|
"node": ">=18.x"
|