Closed bbigras closed 9 years ago
Hi Bruno - thanks for reporting the issue.
How are you including and calling logging
?
Do you mean for logging to be /project
instead of node_modules
?
Is /node-ftp/app.js
on github?
What version of node are you using?
Sorry I didn't censor my project name properly. node-ftp
is the name of my local project (it's not the one from github).
The log was supposed to looks like this :
/home/bbigras/project/node_modules/logging/lib/logging.js:83
: (args.name && args.name != 'forEach' ? args.name : calledFrom(args.caller, c
^
TypeError: Illegal access to a strict mode caller function.
at calledFrom (/home/bbigras/project/node_modules/logging/lib/logging.js:83:107)
at calledFrom (/home/bbigras/project/node_modules/logging/lib/logging.js:83:92)
at calledFrom (/home/bbigras/project/node_modules/logging/lib/logging.js:83:92)
at calledFrom (/home/bbigras/project/node_modules/logging/lib/logging.js:83:92)
at /home/bbigras/project/node_modules/logging/lib/logging.js:97:74
at /home/bbigras/project/app.js:323:23
at [object Object].parse (/home/bbigras/project/node_modules/jsftp/jsftp.js:289:13)
at onElement (/home/bbigras/project/node_modules/jsftp/node_modules/streamer/streamer.js:184:36)
at Socket.<anonymous> (/home/bbigras/project/node_modules/jsftp/jsftp.js:239:25)
at Array.forEach (native)
node v0.6.0 logging 2.0.12
I'm using logging like this :
var log = require('logging').from("logfile.txt");
console.log("context", "status");
Sorry for the little confusion.
I think I have this bug since upgrading to node 0.6.0.
I'm trying to reproduce using node 0.6.0 and everything seems to be running fine until I turn on "use strict"
. Logging doesn't support strict mode because I use an old hack (arguments.caller
) to get the function name. Do you know if you have that somewhere in your code? If you aren't able to remove the strict I'll see if I can detect that it is on and not use that code.
A small typo in your code unrelated to this bug:
var log = require('logging').from("logfile.txt");
The purpose of from is to show you which javascript file the message is from. If you use __filename
(double underscore filename) it will automatically get the name of the javascript file. This is optional and what you are doing will work too.
I don't use use strict
directly but it seems socket.io
or socket.io-client
does.
Thanks for the tip.
I got this :
/home/bbigras/node-ftp/app.js:323:23 is
Other uses of the log() command worked fine.