Sails: Sails 0.12 obviously not compatible with Winston 3.0

Created on 13 Mar 2018  ·  14Comments  ·  Source: balderdashy/sails


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
};

helpful info or workaround needs documentation

Most helpful comment

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

All 14 comments

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]

ok, fixed!

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]

ok, fixed!

@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.

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

Hello,

You're welcome.

Yes, that approach doesn't work.

On Sun, Mar 25, 2018 at 5:07 PM, Mike McNeil notifications@github.com
wrote:

@egomezr https://github.com/egomezr thanks for posting your workaround!
To make sure I understand, you were having issues using the approach
documented here
https://sailsjs.com/documentation/reference/configuration/sails-config-log#?using-a-custom-logger
with Winston 3.x?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/balderdashy/sails/issues/4337#issuecomment-375999261,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABjqzRO5riWiv-v2ZAb1Ir5mj2oHVqMuks5th_j7gaJpZM4Sn4iM
.

@egomezr thanks 👍 Will look into it asap

Excellent!! :-)

On Sun, Mar 25, 2018 at 6:25 PM, Mike McNeil notifications@github.com
wrote:

@egomezr https://github.com/egomezr thanks 👍 Will look into it asap


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/balderdashy/sails/issues/4337#issuecomment-376004813,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABjqzfwzxa0l93EfHhw2aomoELowlCkpks5tiAtjgaJpZM4Sn4iM
.

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

Quick fix applied to captains-log fixed the issue for me:
https://github.com/balderdashy/captains-log/pull/21

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

Thanks for an answer ;)

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

radoslavpetranov picture radoslavpetranov  ·  4Comments

victory-deployment picture victory-deployment  ·  4Comments

3imed-jaberi picture 3imed-jaberi  ·  3Comments

G2Jose picture G2Jose  ·  4Comments

randallmeeker picture randallmeeker  ·  4Comments