node-logger icon indicating copy to clipboard operation
node-logger copied to clipboard

logger.js doesn't work in nodejs ver12.

Open taharactrl opened this issue 5 years ago • 2 comments

sys.print is not defined in nodejs ver 12.

$ node
Welcome to Node.js v12.6.0.
Type ".help" for more information.
> const logger = require('logger').createLogger()
undefined
> (node:18732) [DEP0025] DeprecationWarning: sys is deprecated. Use util instead.
> logger.info('Hello World')
Thrown:
TypeError: this.write is not a function
    at Logger.log (*****/node_modules/logger/logger.js:99:10)
    at Logger.<computed> [as info] (*****/node_modules/logger/logger.js:109:21)

Please change sys.print to console.log.

taharactrl avatar Jul 29 '19 05:07 taharactrl

I have this issue too ^^ Any update?

Isan-Rivkin avatar Mar 20 '20 22:03 Isan-Rivkin

As the "sys"-lib as deprecated, I manually updated to "util" as suggested by the console. In "util" there is no write. It may have been possible to have existed in "sys", but it doesn't exist in "util" and that's why you get that error. I edited it to console.log so that it is printed out in the console as intended. The deprecation warning should be fixed, as well. To the original author of this package: You are free to have a look into my "fix" and use it in your package. I am just trying to help and use it as the others and I am not wanting to steal any credit. As writen below and in the description of my package: All the credits go to you.

npm-package-name: ccipher (https://www.npmjs.com/package/ccipher)

Disclaimer: I am not the creator of the repository nor the npm package. I just needed a logger for my project, found this one and fixed some issues. All the credits go to the original creator of the npm package.

MagicHome007 avatar Jul 22 '21 15:07 MagicHome007