lambda-live-debugger 0.0.114 → 0.0.115

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.
@@ -58,7 +58,7 @@ async function onMessageFromLambda(message) {
58
58
  }
59
59
  }
60
60
  if (Configuration.config.verbose) {
61
- Logger.verbose(`[Function ${message.data.functionId}] Response: `, JSON.stringify(message.data, null, 2));
61
+ Logger.log(`[Function ${message.data.functionId}] Response: `, JSON.stringify(message.data, null, 2));
62
62
  }
63
63
  else {
64
64
  // first 50 characters of the response
@@ -69,7 +69,7 @@ async function onMessageFromLambda(message) {
69
69
  }
70
70
  const response = await NodeHandler.invokeLambda(message.data);
71
71
  if (Configuration.config.verbose) {
72
- Logger.verbose(`[Function ${message.data.functionId}] Response: `, JSON.stringify(response, null, 2));
72
+ Logger.log(`[Function ${message.data.functionId}] Response: `, JSON.stringify(response, null, 2));
73
73
  }
74
74
  else {
75
75
  // first 50 characters of the response
@@ -22,7 +22,7 @@ import { LambdaConnection } from './lambdaConnection.mjs';
22
22
  async function run() {
23
23
  const version = await getVersion();
24
24
  Logger.log(`Welcome to Lambda Live Debugger 🐞 version ${version}.`);
25
- Logger.log('To keep the project moving forward, please fill out the feedback form at https://forms.gle/v6ekZtuB45Rv3EyW9. Your input is greatly appreciated!');
25
+ Logger.important('To keep the project moving forward, please fill out the feedback form at https://forms.gle/v6ekZtuB45Rv3EyW9. Your input is greatly appreciated!');
26
26
  await Configuration.readConfig();
27
27
  Logger.setVerbose(Configuration.config.verbose === true);
28
28
  Logger.verbose(`Parameters: \n${Object.entries(Configuration.config)
@@ -41,8 +41,7 @@ async function run() {
41
41
  }
42
42
  Logger.log(`Starting the debugger ${Configuration.config.observable
43
43
  ? 'in observable mode'
44
- : `(ID ${Configuration.config.debuggerId})`}
45
- ...`);
44
+ : `(ID ${Configuration.config.debuggerId})`}...`);
46
45
  if (Configuration.config.subfolder) {
47
46
  // change the current working directory to the subfolder for monorepos
48
47
  const newCurrentFolder = path.resolve(Configuration.config.subfolder);
package/dist/logger.d.ts CHANGED
@@ -1,17 +1,38 @@
1
1
  /**
2
- * Log verbose message in verbose logging is enabled
3
- * @param args
2
+ * Log a message
3
+ * @param args The arguments to log
4
+ */
5
+ declare function log(...args: any[]): void;
6
+ /**
7
+ * Log an important message
8
+ * @param args The arguments to log
9
+ */
10
+ declare function important(...args: any[]): void;
11
+ /**
12
+ * Log an error message in red
13
+ * @param args The arguments to log
14
+ */
15
+ declare function error(...args: any[]): void;
16
+ /**
17
+ * Log a warning message in orange
18
+ * @param args The arguments to log
19
+ */
20
+ declare function warn(...args: any[]): void;
21
+ /**
22
+ * Log a verbose message if verbose is enabled. Log the message in grey.
23
+ * @param args The arguments to log
4
24
  */
5
25
  declare function verbose(...args: any[]): void;
6
26
  /**
7
- *
8
- * @param enabled
27
+ * Set the verbosity of logging
28
+ * @param enabled Whether verbose logging should be enabled
9
29
  */
10
30
  declare function setVerbose(enabled: boolean): void;
11
31
  export declare const Logger: {
12
- log: (message?: any, ...optionalParams: any[]) => void;
13
- error: (message?: any, ...optionalParams: any[]) => void;
14
- warn: (message?: any, ...optionalParams: any[]) => void;
32
+ log: typeof log;
33
+ error: typeof error;
34
+ warn: typeof warn;
35
+ important: typeof important;
15
36
  verbose: typeof verbose;
16
37
  setVerbose: typeof setVerbose;
17
38
  };
package/dist/logger.mjs CHANGED
@@ -1,24 +1,62 @@
1
+ import chalk from 'chalk';
2
+ const orange = '#D24E01';
1
3
  let verboseEnabled = false;
2
4
  /**
3
- * Log verbose message in verbose logging is enabled
4
- * @param args
5
+ * Log a message
6
+ * @param args The arguments to log
7
+ */
8
+ function log(...args) {
9
+ args = args.map((arg) => {
10
+ if (typeof arg === 'string') {
11
+ // Regular expression to find text within square brackets
12
+ return arg.replace(/\[(.*?)\]/g, (match) => chalk.gray(match)); // Colorizes the entire bracketed content
13
+ }
14
+ return arg;
15
+ });
16
+ console.log(...args);
17
+ }
18
+ /**
19
+ * Log an important message
20
+ * @param args The arguments to log
21
+ */
22
+ function important(...args) {
23
+ console.log(chalk.hex(orange)(...args));
24
+ }
25
+ /**
26
+ * Log an error message in red
27
+ * @param args The arguments to log
28
+ */
29
+ function error(...args) {
30
+ console.error(chalk.red(...args));
31
+ }
32
+ /**
33
+ * Log a warning message in orange
34
+ * @param args The arguments to log
35
+ */
36
+ function warn(...args) {
37
+ console.warn(chalk.hex(orange)(...args));
38
+ }
39
+ /**
40
+ * Log a verbose message if verbose is enabled. Log the message in grey.
41
+ * @param args The arguments to log
5
42
  */
6
43
  function verbose(...args) {
7
44
  if (verboseEnabled) {
8
- console.info(...args);
45
+ console.info(chalk.grey(...args));
9
46
  }
10
47
  }
11
48
  /**
12
- *
13
- * @param enabled
49
+ * Set the verbosity of logging
50
+ * @param enabled Whether verbose logging should be enabled
14
51
  */
15
52
  function setVerbose(enabled) {
16
53
  verboseEnabled = enabled;
17
54
  }
18
55
  export const Logger = {
19
- log: console.log,
20
- error: console.error,
21
- warn: console.warn,
56
+ log,
57
+ error,
58
+ warn,
59
+ important,
22
60
  verbose,
23
61
  setVerbose,
24
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-live-debugger",
3
- "version": "0.0.114",
3
+ "version": "0.0.115",
4
4
  "type": "module",
5
5
  "description": "Debug Lambda functions locally like it is running in the cloud",
6
6
  "repository": {
@@ -91,6 +91,7 @@
91
91
  "@aws-sdk/client-s3": "^3.577.0",
92
92
  "@aws-sdk/credential-providers": "^3.577.0",
93
93
  "aws-iot-device-sdk": "^2.2.13",
94
+ "chalk": "^5.3.0",
94
95
  "chokidar": "^3.6.0",
95
96
  "commander": "^12.0.0",
96
97
  "esbuild": "^0.20.1",
@@ -117,7 +118,8 @@
117
118
  "yaml",
118
119
  "typescript",
119
120
  "inquirer",
120
- "jsonc-parser"
121
+ "jsonc-parser",
122
+ "chalk"
121
123
  ],
122
124
  "workspaces": [
123
125
  "src/extension/*",