javascript - How do I log anything to the console from meteor shell? -
this github issue documents console doesn't output meteor shell. there workarounds? default console.log()
statements output in app's stdout (not in shell).
let's want print items collection:
meteor.users.find().foreach(function (user) { if (...) console.log(user.emails[0].address; });
that won't print anything. here's i've tried:
process.stdout.write()
- doesn't print anythingcreate string buffer, append want log it, , evaluate it.
var output = ''; meteor.users.find().foreach(function (user) { if (...) output += user.emails[0].address + "\n" }); output;
this works
\n
echoed literally, not line feed.- evaluate expression in function. predictably, doesn't print anything.
one workaround i've used run app in background, run shell in same window. i.e.
meteor run & meteor shell
that way, gets output in app's console gets printed window. admittedly, won't if want log specific messages shell, helps if want avoid switching , forth between multiple windows time.
Comments
Post a Comment