Skip to content

Commit fcb0c71

Browse files
vladiulianbogdanandiradulescu
authored andcommitted
Use flatted to avoid circulare dependecies.
1 parent 07b4778 commit fcb0c71

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

dist/index.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,8 @@
4242
"react-native": "^0.67.1",
4343
"rimraf": "^3.0.2",
4444
"typescript": "^4.5.5"
45+
},
46+
"dependencies": {
47+
"flatted": "^3.2.2"
4548
}
4649
}

src/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { NativeModules } from "react-native";
2+
import { stringify } from 'flatted';
23

34
declare var global: any;
45

@@ -154,7 +155,7 @@ class FileLoggerStatic {
154155
if (this._sendFileLogsAlsoToConsole) {
155156
let outputMessage = msg;
156157
args.forEach((arg: any) => {
157-
outputMessage += ` ${arg.toString()}`
158+
outputMessage += ` ${stringify(arg)}`
158159
});
159160

160161
console.log(`${new Date().toISOString()} | [${level}]: ${outputMessage}`);
@@ -207,7 +208,7 @@ export const defaultFormatter: LogFormatter = (level, msg, context, ...args) =>
207208
let message = `${now.toISOString()} [${levelName}] ${msg} ${context}`;
208209

209210
args.forEach((arg: any) => {
210-
message += ` ${arg.toString()}`
211+
message += ` ${stringify(arg)}`
211212
});
212213

213214
return message;
@@ -219,7 +220,7 @@ export const jsonFormatter: LogFormatter = (level, msg, context, ...args) => {
219220
let message = msg;
220221

221222
args.forEach((arg: any) => {
222-
message += ` ${arg.toString()}`
223+
message += ` ${stringify(arg)}`
223224
});
224225

225226
return JSON.stringify({

0 commit comments

Comments
 (0)