-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to support logging (console.log) statement in microcule example java script index.js file? #46
Comments
What operating system on you on? Is it Windows? Also, what is your node -v and npm -v and microcule -v values returning on console? The default behavior for console.log in microcule services should be to write directly to your console. This is the default logger that should being run: https://github.com/Stackvana/microcule/blob/master/lib/plugins/logger.js It's also possible to easily override this logging behavior with your own custom logging middleware. How are you starting the microcule server? |
Hi, Yes i am using windows 10 OS with npm-5.6.0, microcule-6.0.0,node-v8.11.1. I tried both way to start microcule first npm start and second direct index file run like microcule ./index.js module['exports'] = function calculateSal(req, res) {
var flow = require('../setup.js');
var logger = require('../logger.js'); //custom logger class using witson
//console.log("input salary is:", req.params.salary); //Not working
//console.log("input pf is:", req.params.pf); //Not working
logger.info('input salary is:%s', req.params.salary);
logger.info('input pf is:%s', req.params.pf);
flow.totalSal(req.params.salary, req.params.pf).then(totalsal => {
res.json({
message: "Salray calculated successfully",
salary: req.params.salary,
PF: req.params.pf,
totalSal: totalsal
});
}).catch(err => {
res.json({
errorMessage: "salary is not proper."
});
});
}; Here just one sample am trying calculate total salary with post json request using postman
In this total sal function it just adding both salary+pf and return response.
1.These first two logger i want to print in console.we can print this in console? |
To answer your questions:
It looks like Maybe try running the bare-bone examples instead of using see: https://github.com/Stackvana/microcule/blob/master/examples/http-server-simple.js Would also be good if you could to test on non-windows machine. |
Hi Above comment third point am able to resolve.I set output content type in microcule\lib\plugins\spawn\index.js file. so am getting response as json format.If possible clarify me first and second point.Thanks. |
It would be best if you could use the latest version of Calling res.writeHead(200, { 'Content-Type': 'application/json' });
I'm not seeing any of the logging behavior acting strange here or in production. We have a good code coverage for hook.io which consumes microcule and serves it in production, but I'm looking at the |
I am not able to find the log statement added with console.log() in microcule js example index,js. also,In microcule any Js example index.js file am adding console.log() ,but that log statement is not displaying in my command prompt.If i use res.write('') that logs displaying in browser,any possibilities to support logging statement using console.log that will display in console not browser?
The text was updated successfully, but these errors were encountered: