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.

Formatting example

See original GitHub issue

It took me long time to figure out some simple formatting. The examples I found with a formatter function, simply did not work for me. Finally I got this working:

  logger.add(new winston.transports.File({
    level: 'info', // Log this level and all higher priorities
    filename: 'myfile.log',
    format: winston.format.combine(
      winston.format(options => {
        return {
          'level': options.level,
          'message': options.message,
          'my_own_nr': 12345,
          'nice_text': 'hello there'
        }
      })(),
      winston.format.timestamp(),
      winston.format.json()
    )
  }))

Maybe good to add to documentation?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
xiulunlincommented, Mar 14, 2019

+1 Don’t know how to configure

0reactions
fourpastmidnightcommented, Jun 12, 2021

There is a comment on #1430 which resolves the issue with info “losing data” between transports.

Read more comments on GitHub >

github_iconTop Results From Across the Web

6 Content Formatting Examples to Energize Your Blog Format
A comprehensive look at how to create a blog format that gets read and remembered. Review these six content formatting examples for better...
Read more >
Formatting Style Types & Examples - Video & Lesson Transcript
An example of formatting would include whether the paper is double spaced or single spaced, where the page numbers are located, and whether ......
Read more >
4 Best Documentation Formatting Examples
In this article, we'll go over technical documentation formatting best practices and some documentation formatting examples and tips you can use.
Read more >
MLA General Format - Purdue OWL
Here is a sample of the first page of a paper in MLA style: This image shows the first page of an MLA...
Read more >
Text Formatting Examples - Wiki
Italicized text here. | ''Italicized text here.'' Strong emphasized | '''Strong emphasized'''. Strong italic text:-) | '''Strong ''italic ...
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