winston logger levels

const winston = require('winston');

const loggers = {
  mjson: winston.createLogger({
    level: 'info',
    format: winston.format.json(),
    transports: [new winston.transports.File({ filename: 'app-info.log'})],
  }),

  simple: winston.createLogger({
    level: 'error',
    format: winston.format.simple(),
    transports: [new winston.transports.File({ filename: 'app-error.log'}),],
  })
};


loggers.mjson.info('Information message');
loggers.mjson.error('Error message');
loggers.mjson.debug('Some message');

loggers.simple.error('Error message');
loggers.simple.info('Information message');
loggers.simple.warn('Warning message');
loggers.simple.debug('Some message');

4.1
10
Jsc42 105 points

                                    { 
  error: 0, 
  warn: 1, 
  info: 2, 
  http: 3,
  verbose: 4, 
  debug: 5, 
  silly: 6 
}

4.1 (10 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
winston logstash winston.createLogger const logger = winston.createLogger({ logging what is winston medium logging what is winston how to log to a file with winston logger add logger with winston examples winston log browser details winston log browser winston custom log levels logstash winston nodejs winston logger logging winston js winston logging a object winston logger format.print winston logger format winston add logs to json file winston loggar add function information winston loggar add file information winston write logs to file winston.log in nodejs winston.log winston logger node js example winston logger creating particular log file for each level winston logging objects to string node winston logger winston logger log levels winston logger console file path winston loglevel add winston logger to nodejs winston logger demo logging nodejs winston winston logging node js winston logger tutorial log levels in winston winston log request and response use winston logger with express winston logger with express winston log objects winston logger node js medium var logger = new (winston.Logger)({ daily logger.info winston not log in daily rotated file logger.info winston not log winston log nodejs production logger winston winston logger npm winston logger nodejs winston logger daily file winston logger.log with callback winston logger turn off in options Complete Winston Logger Guide winston logger log json object nodejs winston log object logger with time winston winston log object Winston log file name export winston logger how to view winston logger in node js winston logger module name winston logger production winston logger newrelic winston log tet test log from winston logger winston logger node js example text file winston logger open source dashboard add logger category winston winston use custom log levels winston log levels winston logger typescript how to test winston logger output winston log liberary how to use winston logger logger winston npm winston logger winston logger documentation winston log format winston logger formats winston logs meta data in winston logger winston http logger winston logger example app.use logger winston winston log errors winston logger transports winston logger typescript logging everything winston logger object time winston logger object winston logging tutorial where are winston logs stored node winston logger meta node winston logger splat winston logger node js winston logging level winston logger winston logger levels winston logging nodejs
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source