expensify-common 2.0.136 → 2.0.138
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 +3 -1
- package/dist/Logger.js +3 -2
- package/dist/fastMerge.js +2 -1
- package/package.json +1 -1
package/dist/Logger.d.ts
CHANGED
|
@@ -17,13 +17,15 @@ type LoggerOptions = {
|
|
|
17
17
|
serverLoggingCallback: ServerLoggingCallback;
|
|
18
18
|
isDebug: boolean;
|
|
19
19
|
clientLoggingCallback: ClientLoggingCallBack;
|
|
20
|
+
maxLogLinesBeforeFlush?: number;
|
|
20
21
|
};
|
|
21
22
|
export default class Logger {
|
|
22
23
|
logLines: LogLine[];
|
|
23
24
|
serverLoggingCallback: ServerLoggingCallback;
|
|
24
25
|
clientLoggingCallback: ClientLoggingCallBack;
|
|
25
26
|
isDebug: boolean;
|
|
26
|
-
|
|
27
|
+
maxLogLinesBeforeFlush: number;
|
|
28
|
+
constructor({ serverLoggingCallback, isDebug, clientLoggingCallback, maxLogLinesBeforeFlush }: LoggerOptions);
|
|
27
29
|
/**
|
|
28
30
|
* Ask the server to write the log message
|
|
29
31
|
*/
|
package/dist/Logger.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const MAX_LOG_LINES_BEFORE_FLUSH = 50;
|
|
4
4
|
class Logger {
|
|
5
|
-
constructor({ serverLoggingCallback, isDebug, clientLoggingCallback }) {
|
|
5
|
+
constructor({ serverLoggingCallback, isDebug, clientLoggingCallback, maxLogLinesBeforeFlush }) {
|
|
6
6
|
// An array of log lines that limits itself to a certain number of entries (deleting the oldest)
|
|
7
7
|
this.logLines = [];
|
|
8
8
|
this.serverLoggingCallback = serverLoggingCallback;
|
|
9
9
|
this.clientLoggingCallback = clientLoggingCallback;
|
|
10
10
|
this.isDebug = isDebug;
|
|
11
|
+
this.maxLogLinesBeforeFlush = maxLogLinesBeforeFlush || MAX_LOG_LINES_BEFORE_FLUSH;
|
|
11
12
|
// Public Methods
|
|
12
13
|
this.info = this.info.bind(this);
|
|
13
14
|
this.alert = this.alert.bind(this);
|
|
@@ -60,7 +61,7 @@ class Logger {
|
|
|
60
61
|
this.client(`${message} - ${JSON.stringify(parameters)}`, extraData);
|
|
61
62
|
}
|
|
62
63
|
// If we're over the limit, flush the logs
|
|
63
|
-
if (length >
|
|
64
|
+
if (length > this.maxLogLinesBeforeFlush || forceFlushToServer) {
|
|
64
65
|
this.logToServer();
|
|
65
66
|
}
|
|
66
67
|
}
|
package/dist/fastMerge.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
'worklet';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/* eslint-disable @typescript-eslint/prefer-for-of */
|
|
4
5
|
// Mostly copied from https://medium.com/@lubaka.a/how-to-remove-lodash-performance-improvement-b306669ad0e1
|
|
5
6
|
/**
|
|
6
7
|
* Checks whether the given value can be merged. It has to be an object, but not an array, RegExp or Date.
|