Skip to content
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

Sails 0.12 obviously not compatible with Winston 3.0 #4337

Open
egomezr opened this issue Mar 13, 2018 · 14 comments
Open

Sails 0.12 obviously not compatible with Winston 3.0 #4337

egomezr opened this issue Mar 13, 2018 · 14 comments

Comments

@egomezr
Copy link

egomezr commented Mar 13, 2018

Sails version: 0.12.13
Node version: 6.10.2
NPM version: 3.10.10
DB adapter name: N/A
DB adapter version: N/A
Operating system: Ubuntu 16.04


I'm unable to run Sails along with Winston. Looks that Sails is executing a sort of binding.

The main error is:
Uncaught TypeError: this.write is not a function

I found a workaround doing the following:

let winstonLogger = createLogger(loggerSettings);
let logger = {
    'info': function () {
        winstonLogger.info(...arguments);
    },
    'debug': function () {
        winstonLogger.debug(...arguments);
    },
    'error': function () {
        winstonLogger.error(...arguments);
    },
    'warn': function () {
        winstonLogger.warn(...arguments);
    },
    'log': function () {
        winstonLogger.log(...arguments);
    }
};
// End of workaround

module.exports.log = {
    custom: logger,
    inspect: false
};
@sailsbot
Copy link

Hi @egomezr! It looks like you may have removed some required elements from the initial comment template, without which I can't verify that this post meets our contribution guidelines. To re-open this issue, please copy the template from here, paste it at the beginning of your initial comment, and follow the instructions in the text. Then post a new comment (e.g. "ok, fixed!") so that I know to go back and check.

Sorry to be a hassle, but following these instructions ensures that we can help you in the best way possible and keep the Sails project running smoothly.

*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]

@egomezr
Copy link
Author

egomezr commented Mar 13, 2018

ok, fixed!

@sailsbot
Copy link

Sorry to be a hassle, but it looks like your issue is still missing some required info. Please double-check your initial comment and try again.

*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]

@egomezr
Copy link
Author

egomezr commented Mar 13, 2018

ok, fixed!

@sailsbot
Copy link

@egomezr Thanks for posting, we'll take a look as soon as possible.


For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here.

@mikermcneil
Copy link
Member

@egomezr thanks for posting your workaround! To make sure I understand, you were having issues using the approach documented here with Winston 3.x?

@egomezr
Copy link
Author

egomezr commented Mar 25, 2018 via email

@mikermcneil
Copy link
Member

@egomezr thanks 👍 Will look into it asap

@egomezr
Copy link
Author

egomezr commented Mar 25, 2018 via email

@alexschwarz89
Copy link

Hello everyone, just wanted to say that with Sails v1.0 its the same problem. I've tried the new createLogger syntax, but i'm getting the same error as @egomezr

@mosgamal
Copy link

Quick fix applied to captains-log fixed the issue for me:
balderdashy/captains-log#21

@semy
Copy link

semy commented Jul 10, 2018

What is the Status here? With Sails v1.0 the example here does not work...

Thanks for an answer ;)

@luislobo
Copy link
Contributor

Created PR that should fix this. balderdashy/captains-log#25

@johnabrams7
Copy link
Contributor

johnabrams7 commented Apr 16, 2019

Thanks for the PR fix @luislobo. Everyone else's thoughts and testing are welcome on this too.

davericher added a commit to funsocietyirc/MrNodeBot that referenced this issue Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

8 participants