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

fileAsyncTransport() error #66

Closed KrSerg closed 2 years ago

KrSerg commented 2 years ago

Hi guys!

Noticed error in fileAsyncTransport function. If I won't use 'date-today' option in fileName - log file will be always named as 'log'.

Seems like you have an error in line 93: } else if (props?.options?.fileName) props.options.fileName;

should be changed to: } else if (props?.options?.fileName) fileName = props.options.fileName;

dmytro-ivonin commented 2 years ago

Also, it would be great to have a custom file name with the date-today option for ex., 'my_app_v1.0_2022-07-04_qa.log' (where 2022-07-04 is date-today).

alessandro-bottamedi commented 2 years ago

Also, it would be great to have a custom file name with the date-today option for ex., 'my_app_v1.0_2022-07-04_qa.log' (where 2022-07-04 is date-today).

Good idea! fixed in v 5.0.1, now you can insert in the file name {date-today} and and it will be replaced with today's date, example: fileName: 'my_app_v1.0_{date-today}_qa.log'.

fileName fixed too, thanks @KrSerg.

KrSerg commented 2 years ago

@alessandro-bottamedi, thanks for such a quick fix! 👍

dmytro-ivonin commented 2 years ago

works as expected. thanks!