Zaelot-Inc / use-reducer-logger

A very basic logger for the useReducer function in the React Hooks API.
https://www.npmjs.com/package/use-reducer-logger
MIT License
94 stars 16 forks source link

Action transformer support #7

Open popadorin opened 4 years ago

popadorin commented 4 years ago

I would be nice to have some options to logger same as redux-logger so that you can change the way you want the actions.

ex: Pleasant logs in typescript

If types are created as Enum values -> they appear as numbers (If not writing boilerplate code - the string values of the enum values) in logs. In order to avoid that some transforms can be made and the action transform to be added to the logger as option.

no boilerplate code (but with log issues)

enum Type {
  type1,
  type2
}

appears in logs as 0, 1 instead of type1 and type2. In order to avoid this boilerplate as seen bellow, needed some actionTransformer.

boilerplate code

enum Type {
  type1 = 'type1',
  type2 = 'type2'
}