samdenty / console-feed

Captures console.log's into a React Component 🔥
https://stackblitz.com/~/github.com/samdenty/console-feed
MIT License
660 stars 110 forks source link

console.log(event) doesn't print all the key value pairs #71

Open KVPasupuleti opened 3 years ago

KVPasupuleti commented 3 years ago

I am using console-feed in my custom code editor. It is working fine with all other things, but showing only one key for an event object and some other responses with larger objects.

This is the JS code I have used

js_code_for_console_bug

This is the console-feed output I got,

custom_console_output

This is the output in the chrome console

chrome_console_output

Is there any workaround or am I missing something?

samdenty commented 3 years ago

I believe the event properties are stored on prototype. We don't serialize prototypes currently as that can be quite expensive.

KVPasupuleti commented 3 years ago

So, what would be the solution?

Should I fork the repo and write my custom script for printing all the available key-value pairs in an object using a for loop?

Or is there an alternative?

Could you please help? :slightly_smiling_face:

samdenty commented 3 years ago

you should fork - you could add a custom transform for Event (https://github.com/samdenty/console-feed/blob/master/src/Transform/index.ts), or change something here - https://github.com/samdenty/console-feed/blob/3fc8a958640f71d06d8edcdd1a00a300c4b9337c/src/Transform/replicator/index.ts#L97, probably remove the reflect.has check

chaitanya71998 commented 3 years ago

you should fork - you could add a custom transform for Event (https://github.com/samdenty/console-feed/blob/master/src/Transform/index.ts), or change something here -

https://github.com/samdenty/console-feed/blob/3fc8a958640f71d06d8edcdd1a00a300c4b9337c/src/Transform/replicator/index.ts#L97

, probably remove the reflect.has check

tried this and upon trying yarn build got this, yarn run v1.22.5 $ tsc -p ./tsconfig.build.json --declaration && for file in src/**/*.d.ts; do cp $file ${file/src/lib}; done /bin/sh: 1: Bad substitution error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. can you help me how to solve this

samdenty commented 3 years ago

@chaitanya71998 hmm that's odd. You can try manually building with tsc -p ./tsconfig.build.json --declaration

chaitanya71998 commented 3 years ago

i tried removing && for file in src/**/*.d.ts; do cp $file line in package build line and did yarn build, Build got done and lib file is generated, now with the lib file in the forked branch i replaced with my projects's console-feed lib file but there is no change. any other insights

chaitanya71998 commented 3 years ago

can you suggest how to add custom transform for event