No console log when using fly programatically?
See original GitHub issueBackground
I’m building a tool similar to next
or create-react-app
but for simple websites without react etc. We are currently using gulp but I’d like to replace that with fly. The current code can be found here.
The problem
I don’t seem to be able to get fly to log the expected output when using it programatically. The console is blank but if I run console.log('whatever')
inside a task that’ll show. Am I missing some option? Or is this a intended behaviour?
Sample code
// lib/utils/taskRunner.js
function startTaskRunner() {
const cwd = path.join(__dirname, '..');
const file = path.join(cwd, 'flyfile.js');
const fly = new Fly({
file,
cwd,
plugins: [
require('fly-clear'),
],
});
fly.start();
}
startTaskRunner();
// lib/flyfile.js
exports.clean = function* (fly) {
yield fly.clear('dist');
};
exports.default = function* (fly) {
yield fly.start('clean');
};
Thankful for any pointers
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to quickly and conveniently disable all console.log ...
Redefine the console.log function in your script. console.log = function() {}. That's it, no more messages to console. EDIT: Expanding on Cide's idea....
Read more >Debugging Flutter apps programmatically
Note: You can view logs in DevTools' Logging view or in your system console. This sections shows how to set up your logging...
Read more >How to remove console log from your JavaScript files ...
Learn how to remove JavaScript console methods such as console log programmatically from your JavaScript files.
Read more >Debugger | Node.js v19.3.0 Documentation
Node.js includes a command-line debugging utility. The Node.js debugger client is not a full-featured debugger, but simple stepping and inspection are ...
Read more >Place Autocomplete | Maps JavaScript API - Google Developers
console.log("Returned place contains no geometry"); return; ... To retrieve predictions programmatically, use the AutocompleteService class.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lukeed Oh that looks great! I will definitely give Taskr another try, wouldn’t be surprised if it replaces gulp now 😉
Thanks guys 😄
Hi @alexandernanberg!
Unfortunately, it seems as though you’ve left us for Gulp 😿 … but that’s okay 😜
Just wanted to let you know that you could have done this:
The reason this wasn’t done by default (with every instance) is that it’s generally not wanted in programmatic use. This is because most of the time, it’s used as a silent runner & the main/parent tool is handling is own logging or
stdout
prints.This follows the same pattern as our main
cli.js
boot script – here.Aside from that, as @jbucaran mentioned, the only other option for
logging
is thru each task’s first parameter:The full list of inner-task utilities is available here!
Please let me know if that helps and/or you’re willing to give Taskr another try 😉
Thanks!