balderdashy / balderdashy/sails

Sails 0.12 obviously not compatible with Winston 3.0

Open
#4,337 14 comments 0 reactions 0 assignees View on GitHub
helpful info or workaround needs documentation
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**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:**

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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported failure with Sails 0.12.13, Node 6.10.2, and Winston 3.0, using the `this.write is not a function` error as the initial trace. No source file or test is named; done would mean Sails runs with Winston without that error while preserving the reported logging methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.