Giter Site home page Giter Site logo

Comments (9)

s-a avatar s-a commented on July 18, 2024

I do not know debug lib. Does it work without babel? You can configure es6 features and dont need transpiling https://github.com/s-a/iron-node/blob/master/docs/CONFIGURATION.md#v8-flags.
You could set a break point and debug what is going on at debug('init')('starting API');

from iron-node.

jonaswindey avatar jonaswindey commented on July 18, 2024

Updated my example above. Apparently it has nothing to do with babel.

from iron-node.

s-a avatar s-a commented on July 18, 2024

The v8 engine supports any official es6 feature. Since you are not using experimental stuff it might be more stable to debug without babel.
Never tried source maps but it should work as described at [https://developer.chrome.com/devtools/docs/javascript-debugging#using-source maps](https://developer.chrome.com/devtools/docs/javascript-debugging#using-source maps)

If you do not see any log output it definitely belogs to your debug methods. as you mentioned console.log('test') // this is called works.

Have you debuged your log method?

from iron-node.

jonaswindey avatar jonaswindey commented on July 18, 2024

The v8 engine supports any official es6 feature. Since you are not using experimental stuff it might be more stable to debug without babel.

True, except for module imports/exports. But the sourcemaps work great so that's covered.

About the logging, I think I found the problem. Even though we're running in the browser, the logger still thinks it's a node environment, and I guess it's writing it to the stdout or another stream instead of the console.log.
https://github.com/visionmedia/debug/blob/master/example/stdout.js

I guess mongoose does the same.
It would be nice though if iron-node could bind the stdout to console.log, that way it is compatible with all logging systems.

from iron-node.

s-a avatar s-a commented on July 18, 2024

Just wanted to write you in #53 that iron-node is a hybrid environment while all scripts run always in a terminal console context. I dont know maybe you can include a browser version of debug.

from iron-node.

s-a avatar s-a commented on July 18, 2024

It would be nice though if iron-node could bind the stdout to console.log, that way it is compatible with all logging systems.

You can easy write your own Plugins for ironNode like this one.
https://github.com/s-a/iron-node-process-exit-break/blob/master/index.js. Let me know if you created something awesome 😺

from iron-node.

jonaswindey avatar jonaswindey commented on July 18, 2024

Yep, apparently it's possible: https://github.com/visionmedia/debug/blob/master/example/stdout.js
Basically you just bind debug.log to console.log

I'll take a look at the plugins system. Thanks for the help!

from iron-node.

jonaswindey avatar jonaswindey commented on July 18, 2024

Still, I think adding this code in iron-node on startup would help more users because debug is used by a lot of people.

Do you agree?

This is the line to add:

debug.log = console.log.bind(console);

from iron-node.

s-a avatar s-a commented on July 18, 2024

We can do this only if debug was required. I suggest to write a simple package or extend the debug library directly. Maybe they accept a PR. It would make sense to discuss this behavior with the creators of debug because it impacts the electron environment.

from iron-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.