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.

messageFormatter doesn't seem to work (since Winston 3.0.0?)

See original GitHub issue

Hello,

Recently I upgraded to Winston 3.0.0 and decided to add some message formatting as well. I my old setup I never used the messageFormatter property of winston-cloudwatch, but now I felt a need to.

However it seems like the messageFormatter function is never executed. No matter what I change on the logObject or what I return from the function. Even when I do a console.log in the formatter, it never shows up.

I did notice that the whole formatting system of Winston changed quite a bit since 2.x. Maybe this had an impact on this formatter as well? Do you have a working example somewhere?

Best, Thijs

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
lazywithclasscommented, Apr 20, 2020

To have a clean implementation I think we have to move away from the obsolete inheritance model I coded ages ago and introduce the much cleaner class model. This will also allow to get rid of old practices like utils.inherit and winston.Transport.call(this, options), and finally allow us to follow the preferred way of creating a new Transport.

One of my wildest dreams would be also to remove the horrific setInterval (what was I even thinking?!?), and introduce a better approach like @timdp did for his fork https://github.com/timdp/winston-aws-cloudwatch. But I’ll see about that.

This won’t be immediate though and will be surely marked as winston-cloudwatch v3.0.0. I am going though the changes required to make this a reality. If you have a better idea I’m listening ^^

2reactions
petraclescommented, Apr 10, 2020

Hey @lazywithclass, based on your example, it looks like that’s what the ask from OP was - to be able to define a format once and use it for any transport (a Winston one or a WinstonCloudWatch one).

I’m curious to try your example, as I’ve done something similar in the past with no success. I’ll give it another shot soon, and if I get it working, I can come back and post some code 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Winston doesn't pretty-print to console - node.js - Stack Overflow
I figured out the answer (the documentation is incorrect). If you use the constructor, and manually add transports, you can set options, ...
Read more >
Bug List
getInputStream() does not work properly if an InterruptedException happens. ... [IDEA] Undo Convert To Xtend, seems to be ignored by builder, 2015-10-08.
Read more >
Open Source Used In DNAC Platform Guardian - Cisco
This document contains licenses and notices for open source software used in this product.
Read more >
Notices_BigFix_Lifecycle_Starter...
from the use of this NOTICES file or its contents, including without ... MIT json-buffer-3.0.0.tgz JSON parse & stringify that supports binary.
Read more >
@adobe/helix-log - npm Package Health Analysis | Snyk
Logging for Helix For more information about how to use this package see README. Latest version published 1 year ago. License: Apache-2.0.
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