Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of ulog from reactor-ts, code generator updated to allow this change #2052

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class TSParameterPreambleGenerator(
| if (__processedCLArgs.${parameter.name} !== null) {
| __CL${parameter.name} = __processedCLArgs.${parameter.name};
| } else {
| Log.global.error(__clUsage);
| Log.error(null, () => __clUsage);
| throw new Error("Custom '${parameter.name}' command line argument is malformed.");
| }
|}
Expand All @@ -94,7 +94,7 @@ class TSParameterPreambleGenerator(
"""
|if (__processedCLArgs.${parameter.name} !== undefined && __processedCLArgs.${parameter.name} !== null
| && !__noStart) {
| Log.global.info("'${parameter.name}' property overridden by command line argument.");
| Log.info(null, () => "'${parameter.name}' property overridden by command line argument.");
|}"""
}

Expand Down Expand Up @@ -183,7 +183,7 @@ class TSParameterPreambleGenerator(
|try {
| __processedCLArgs = commandLineArgs(__customCommandLineArgs) as __ProcessedCommandLineArgs & __customCLTypeExtension;
|} catch (e){
| Log.global.error(__clUsage);
| Log.error(null, () => __clUsage);
| throw new Error("Command line argument parsing failed with: " + e);
|}
|
Expand All @@ -192,7 +192,7 @@ class TSParameterPreambleGenerator(
| if (__processedCLArgs.fast !== null) {
| __fast = __processedCLArgs.fast;
| } else {
| Log.global.error(__clUsage);
| Log.error(null, () => __clUsage);
| throw new Error("'fast' command line argument is malformed.");
| }
|}
Expand All @@ -202,7 +202,7 @@ class TSParameterPreambleGenerator(
| if (__processedCLArgs.id !== null) {
| __federationID = __processedCLArgs.id;
| } else {
| Log.global.error(__clUsage);
| Log.error(null, () => __clUsage);
axmmisaka marked this conversation as resolved.
Show resolved Hide resolved
| throw new Error("'id (federationID)' command line argument is malformed.");
| }
|}
Expand All @@ -212,7 +212,7 @@ class TSParameterPreambleGenerator(
| if (__processedCLArgs.keepalive !== null) {
| __keepAlive = __processedCLArgs.keepalive;
| } else {
| Log.global.error(__clUsage);
| Log.error(null, () => __clUsage);
| throw new Error("'keepalive' command line argument is malformed.");
| }
|}
Expand All @@ -222,28 +222,28 @@ class TSParameterPreambleGenerator(
| if (__processedCLArgs.timeout !== null) {
| __timeout = __processedCLArgs.timeout;
| } else {
| Log.global.error(__clUsage);
| Log.error(null, () => __clUsage);
| throw new Error("'timeout' command line argument is malformed.");
| }
|}
|
|// Logging parameter (not a constructor parameter, but a command line option)
|if (__processedCLArgs.logging !== undefined) {
| if (__processedCLArgs.logging !== null) {
| Log.global.level = __processedCLArgs.logging;
| Log.setLevel(__processedCLArgs.logging);
| } else {
| Log.global.error(__clUsage);
| Log.error(null, () => __clUsage);
| throw new Error("'logging' command line argument is malformed.");
| }
|} else {
| Log.global.level = Log.levels.${targetConfig.logLevel.name}; // Default from target property.
| Log.setLevel(Log.LogLevel.${targetConfig.logLevel.name}); // Default from target property.
|}
|
|// Help parameter (not a constructor parameter, but a command line option)
|// NOTE: this arg has to be checked after logging, because the help mode should
|// suppress debug statements from it changes logging
|if (__processedCLArgs.help === true) {
| Log.global.error(__clUsage);
| Log.error(null, () => __clUsage);
| __noStart = true;
| // Don't execute the app if the help flag is given.
|}
Expand All @@ -255,23 +255,23 @@ class TSParameterPreambleGenerator(
|// Runtime command line arguments
|if (__processedCLArgs.fast !== undefined && __processedCLArgs.fast !== null
| && !__noStart) {
| Log.global.info("'fast' property overridden by command line argument.");
| Log.info(null, () => "'fast' property overridden by command line argument.");
|}
|if (__processedCLArgs.id !== undefined && __processedCLArgs.id !== null
| && !__noStart) {
| Log.global.info("'id (federationID)' property overridden by command line argument.");
| Log.info(null, () => "'id (federationID)' property overridden by command line argument.");
|}
|if (__processedCLArgs.keepalive !== undefined && __processedCLArgs.keepalive !== null
| && !__noStart) {
| Log.global.info("'keepalive' property overridden by command line argument.");
| Log.info(null, () => "'keepalive' property overridden by command line argument.");
|}
|if (__processedCLArgs.timeout !== undefined && __processedCLArgs.timeout !== null
| && !__noStart) {
| Log.global.info("'timeout' property overridden by command line argument.");
| Log.info(null, () => "'timeout' property overridden by command line argument.");
|}
|if (__processedCLArgs.logging !== undefined && __processedCLArgs.logging !== null
| && !__noStart) {
| Log.global.info("'logging' property overridden by command line argument.");
| Log.info(null, () => "'logging' property overridden by command line argument.");
|}
|
|// Custom command line arguments
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "LinguaFrancaDefault",
"type": "commonjs",
"dependencies": {
"@lf-lang/reactor-ts": "^0.6.0",
"@lf-lang/reactor-ts": "git://github.com/lf-lang/reactor-ts.git#master",
"command-line-args": "^5.1.1",
"command-line-usage": "^6.1.3"
},
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"allowJs": true,
"target": "esnext",
"module": "CommonJS",
"types": ["node", "@lf-lang/reactor-ts", "ulog", "microtime", "command-line-args", "command-line-usage"],
"types": ["node", "@lf-lang/reactor-ts", "microtime", "command-line-args", "command-line-usage"],
"typeRoots": ["./node_modules/@types/", "./node_modules/@lf-lang/reactor-ts/src/core/@types/"],
"esModuleInterop": true,
"isolatedModules": true,
Expand Down
Loading