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

[Bug]: Formatter runs on log call, even if log is not correct level #307

Open
DanKaplanSES opened this issue Jun 29, 2024 · 0 comments
Open

Comments

@DanKaplanSES
Copy link

The problem

For visibility, this is a duplicate of winstonjs/winston#2441 I'm not sure which repo is the correct one to create this in.

What version of Logform presents the issue?

v2.6.0

What version of Node are you using?

v20.10.0

If this is a TypeScript issue, what version of TypeScript are you using?

v5.3.3

If this worked in a previous version of Logform, which was it?

No response

Minimum Working Example

const winston = require('winston');

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.combine(
    winston.format.json(),
    winston.format((input) => {
      let lagger = 0;
      for (let i = 0; i < 1000000000; i++) {
        lagger += 1;
      }
      return input;
    })()
  ),
  defaultMeta: { service: 'user-service' },
  transports: [
    new winston.transports.Console({
      format: winston.format.simple(),
    })
  ],
});

setInterval(() => {
  // I still see formatter for this log in profiler taking up some seconds
  logger.debug('Hello world!');
}, 1000);

Additional information

This bug causes performance issues.

🔎 Search Terms

bug, performance, winston, winstonjs, formatter

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

1 participant