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

TypeError: logger.child is not a function #1568

Closed
1 of 2 tasks
JaehyunLee-B2LiNK opened this issue Jan 18, 2019 · 3 comments
Closed
1 of 2 tasks

TypeError: logger.child is not a function #1568

JaehyunLee-B2LiNK opened this issue Jan 18, 2019 · 3 comments

Comments

@JaehyunLee-B2LiNK
Copy link

JaehyunLee-B2LiNK commented Jan 18, 2019

Please tell us about your environment:

  • winston version?
    • winston@2
    • winston@3
  • _node -v outputs: v10.15.0
  • _Operating System? macOS
  • _Language? ES5/6

What is the problem?

const winston = require('winston');

const logger = winston.createLogger({
  transports: [new winston.transports.Console()],
});
logger.info('logger ok.');

const childLogger = logger.child({ test: 'test value' });
childLogger.info('child logger ok');

What do you expect to happen instead?

{"message":"logger ok.","level":"info"}
{"message":"child logger ok.","level":"info"}

Other information

TypeError: logger.child is not a function
    at Object.<anonymous> (/Users/onlybalance/test/logger.js:12:28)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
@kibertoad
Copy link
Contributor

function child() is only available in Winston 3.2.0 which wasn't released yet

@joernroeder
Copy link

how can i create child loggers in the meantime easily?

@JaehyunLee-B2LiNK
Copy link
Author

JaehyunLee-B2LiNK commented Jan 28, 2019

how can i create child loggers in the meantime easily?

@joernroeder
Now available. It has been updated yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants