Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Log file contains only lots of "undefined" #249

Closed
fabiante opened this issue Nov 1, 2019 · 3 comments
Closed

Log file contains only lots of "undefined" #249

fabiante opened this issue Nov 1, 2019 · 3 comments

Comments

@fabiante
Copy link

fabiante commented Nov 1, 2019

Hi, when using the transport like this:

        return new ((winston.transports as any).DailyRotateFile)({
            filename: 'service-%DATE%.log',
            datePattern: 'DD-MM-YYYY',
            dirname: logFolder,
            zippedArchive: false,
            maxSize: '10m',
            maxFiles: '14d'
        });

and a custom winston format:

winston.format.printf(({ level, message, label, timestamp }) => `${timestamp} ${level} [${label}]: ${message}`)

the output log file only contains lots of "undefined"

@mattberther
Copy link
Member

printf takes an info object. Perhaps you're looking for:

winston.format.printf(info => `${info.timestamp} ${info.level} [${info.label}]: ${info.message}`)

@fabiante
Copy link
Author

fabiante commented Nov 4, 2019

I don't think that is my issue. In fact, my callback function uses a deconstructor to receive those properties.

This printf usage does work. I use a console transport along with the transport of this package and my console output is as expected.

Edit: Just tested you version. No difference. That is not the issue

@fabiante
Copy link
Author

fabiante commented Nov 4, 2019

Sorry, I completely removed my format and used the default one and then it works.

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

No branches or pull requests

2 participants