mowispace / react-native-logs

Performance-aware simple logger for React-Native and Expo with namespaces, custom levels and custom transports (colored console, file writing, etc.)
MIT License
467 stars 33 forks source link

Only merge non undefined config values #105

Closed SYoder1 closed 1 month ago

SYoder1 commented 1 month ago

If you try and create a logger with a conditional in the config and you pass undefined, the sdk will throw an error.

Example: I was trying to only add a stringifyFunc in some cases as added below, but it was causing a crash when initializing the logger. Uncaught TypeError: this._stringifyFunc is not a function

{
    stringifyFunc: isIos ? () => {...} : undefined
}

JSON stringify and parse will remove any undefined values during the merge