question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

winston.createLogger is not a function

See original GitHub issue

Hi,

I just install winston 2.4.0 and testing it. Here is my code:

var winston = require('winston');
require('winston-daily-rotate-file');
exports.logger = winston.createLogger({
    level: 'silly',
    transports: [
        new winston.transports.Console({
        	level: process.env.ENVIRONMENT === 'development' ? 'silly' : 'info'
        }),
        new winston.transports.DailyRotateFile({
            filename:  '../logs',
            datePattern: 'dd-MM-yyyy.',
            prepend: true,
            level: process.env.ENVIRONMENT === 'development' ? 'debug' : 'info'
        })
    ],
    exitOnError: false
});

When I run it throws error: “TypeError: winston.createLogger is not a function

Using default logger is OK, for example:

winston.log('info', 'Hello');

Did I miss something?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

30reactions
kmajorcommented, Oct 18, 2017

I’d like to second that I also ran into this. The Readme should definitely make it clear that the docs are for the release candidate.

Also, thanks for maintaining winston, logging is such a headache.

26reactions
Jelledbcommented, Nov 2, 2017

Same for me. I find it rather odd that you show documentation in your README for a release candidate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: winston.createLogger is not a constructor
The application works fine on my local machine and the problem only occurs on the EC2 instance running Amazon Linux AMI 2. Winston...
Read more >
How to use the winston.createLogger function in winston - Snyk
To help you get started, we've selected a few winston.createLogger examples, based on popular ways it is used in public projects.
Read more >
winston - npm
The simplest way to do this is using winston.createLogger : const winston = require('winston'); const logger = winston.
Read more >
winstonjs/winston - Gitter
Is everybody installing winston by using github master? ... _addDefaultMeta is not a function"error anymore? ... Here is my createLogger config.
Read more >
logging in JavaScript with Winston.js - ZetCode
Logging is not limited to identifying errors in software development. ... A winston logger is created with the createLogger function.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found