expensify-common 2.0.59 → 2.0.60

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/dist/Logger.d.ts CHANGED
@@ -6,7 +6,7 @@ type ServerLoggingCallbackOptions = {
6
6
  type ServerLoggingCallback = (logger: Logger, options: ServerLoggingCallbackOptions) => Promise<{
7
7
  requestID: string;
8
8
  }> | undefined;
9
- type ClientLoggingCallBack = (message: string) => void;
9
+ type ClientLoggingCallBack = (message: string, extraData: Parameters) => void;
10
10
  type LogLine = {
11
11
  message: string;
12
12
  parameters: Parameters;
@@ -34,7 +34,7 @@ export default class Logger {
34
34
  * @param forceFlushToServer Should we force flushing all logs to server?
35
35
  * @param onlyFlushWithOthers A request will never be sent to the server if all loglines have this set to true
36
36
  */
37
- add(message: string, parameters: Parameters, forceFlushToServer: boolean, onlyFlushWithOthers?: boolean): void;
37
+ add(message: string, parameters: Parameters, forceFlushToServer: boolean, onlyFlushWithOthers?: boolean, extraData?: Parameters): void;
38
38
  /**
39
39
  * Caches an informational message locally, to be sent to the server if
40
40
  * needed later.
@@ -44,7 +44,7 @@ export default class Logger {
44
44
  * @param parameters The parameters to send along with the message
45
45
  * @param onlyFlushWithOthers A request will never be sent to the server if all loglines have this set to true
46
46
  */
47
- info(message: string, sendNow?: boolean, parameters?: Parameters, onlyFlushWithOthers?: boolean): void;
47
+ info(message: string, sendNow?: boolean, parameters?: Parameters, onlyFlushWithOthers?: boolean, extraData?: Parameters): void;
48
48
  /**
49
49
  * Logs an alert.
50
50
  *
@@ -72,6 +72,6 @@ export default class Logger {
72
72
  *
73
73
  * @param message The message to log.
74
74
  */
75
- client(message: string): void;
75
+ client(message: string, extraData?: Parameters): void;
76
76
  }
77
77
  export {};
package/dist/Logger.js CHANGED
@@ -49,7 +49,7 @@ class Logger {
49
49
  * @param forceFlushToServer Should we force flushing all logs to server?
50
50
  * @param onlyFlushWithOthers A request will never be sent to the server if all loglines have this set to true
51
51
  */
52
- add(message, parameters, forceFlushToServer, onlyFlushWithOthers = false) {
52
+ add(message, parameters, forceFlushToServer, onlyFlushWithOthers = false, extraData = '') {
53
53
  const length = this.logLines.push({
54
54
  message,
55
55
  parameters,
@@ -57,7 +57,7 @@ class Logger {
57
57
  timestamp: new Date(),
58
58
  });
59
59
  if (this.isDebug) {
60
- this.client(`${message} - ${JSON.stringify(parameters)}`);
60
+ this.client(`${message} - ${JSON.stringify(parameters)}`, extraData);
61
61
  }
62
62
  // If we're over the limit, flush the logs
63
63
  if (length > MAX_LOG_LINES_BEFORE_FLUSH || forceFlushToServer) {
@@ -73,9 +73,9 @@ class Logger {
73
73
  * @param parameters The parameters to send along with the message
74
74
  * @param onlyFlushWithOthers A request will never be sent to the server if all loglines have this set to true
75
75
  */
76
- info(message, sendNow = false, parameters = '', onlyFlushWithOthers = false) {
76
+ info(message, sendNow = false, parameters = '', onlyFlushWithOthers = false, extraData = '') {
77
77
  const msg = `[info] ${message}`;
78
- this.add(msg, parameters, sendNow, onlyFlushWithOthers);
78
+ this.add(msg, parameters, sendNow, onlyFlushWithOthers, extraData);
79
79
  }
80
80
  /**
81
81
  * Logs an alert.
@@ -117,11 +117,11 @@ class Logger {
117
117
  *
118
118
  * @param message The message to log.
119
119
  */
120
- client(message) {
120
+ client(message, extraData = '') {
121
121
  if (!this.clientLoggingCallback) {
122
122
  return;
123
123
  }
124
- this.clientLoggingCallback(message);
124
+ this.clientLoggingCallback(message, extraData);
125
125
  }
126
126
  }
127
127
  exports.default = Logger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expensify-common",
3
- "version": "2.0.59",
3
+ "version": "2.0.60",
4
4
  "author": "Expensify, Inc.",
5
5
  "description": "Expensify libraries and components shared across different repos",
6
6
  "homepage": "https://expensify.com",