awesomeeng / awesome-log

Logging for enterprise ready nodejs applications.
MIT License
34 stars 4 forks source link

Fails in Visual Studio Code #27

Closed jvonehr closed 1 year ago

jvonehr commented 1 year ago

Just found AwesomeLog today & installed it. Nice piece of work, and very nice code, and it seems way cleaner than the other packages I've looked at. Unfortunately, it fails to log anything when I run my code from VisualStudioCode. Buffers the formatted lines during init, then when it finally calls print.call(...) to emit them, that print function is empty.

Testing with your simple test "ExampleUsage.js". Tried it on Mac & Ubuntu with same result. However, it works fine when the test program is run from a command line on either platform, so has to be something VSC is doing. I've tried to follow what's going on, but not yet skilled enough JS programmer to follow the 'interesting' things you're doing.

Update: just tried winston logger, with exactly the same result in VSC vs. command line. Seems like a VSC issue...

arei commented 1 year ago

I have seen this before and IIRC you need to add "outputCapture": "std" to your launch.json file for the executing section. If std doesnt work, try console.

Please let me know if this solves your problem.

jvonehr commented 1 year ago

A bit tricky, but that was the answer!

There doesn’t seem to be a ‘launch.json’ file in current VSC release, so it needs to be created in VSC:

  1. Click the debug icon on the icons at left
  2. It puts up a panel on the left with the option to create a “launch.json” file
  3. Click that, and specify “node.js” environment to open it
  4. Add the “outputCapture”: “std” field inside ‘configurations’

All is well now. Look forward to exploring your nice piece of work. Thanks for this package.

Regards,

Jim

On Oct 13, 2022, at 18:32, Glen R. Goodwin @.***> wrote:

I have seen this before and IIRC you need to add "outputCapture": "std" to your launch.json file for the executing section. If std doesnt work, try console.

Please let me know if this solves your problem.

— Reply to this email directly, view it on GitHub https://github.com/awesomeeng/awesome-log/issues/27#issuecomment-1278282768, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV4UFR22NJTQHL3QX3I7YW3WDCLYZANCNFSM6AAAAAAREXFTAM. You are receiving this because you authored the thread.

arei commented 1 year ago

Glad it work, glad you like the package. Tell your friends! And check out AwesomeServer if you like this one.