quirkey / node-logger

A simple logging library that combines the simple APIs of Ruby's logger.rb and browser-js console.log()
49 stars 54 forks source link

logger.js doesn't work in nodejs ver12. #12

Open taharactrl opened 5 years ago

taharactrl commented 5 years ago

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.

Isan-Rivkin commented 4 years ago

I have this issue too ^^ Any update?

MagicHome007 commented 3 years ago

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.