{"size": 754, "ext": "js", "max_stars_repo_path": "src/components/logger/index.js", "max_stars_repo_name": "AnishLushte07/candidate", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/logger/index.js", "max_issues_repo_name": "AnishLushte07/candidate", "max_issues_repo_issues_event_min_datetime": "2022-02-10T18:44:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-10T18:44:56.000Z", "max_forks_repo_path": "src/components/logger/index.js", "max_forks_repo_name": "AnishLushte07/candidate", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 20.9444444444, "max_line_length": 63, "alphanum_fraction": 0.6114058355}
/*
* Purpose: Use to logging in Sentry, File and Console
* Usage:
* const logger = require('./logger')
export async function test(id) {
  try {
    // your code here
    const testxyz = await test1();
  } catch (e) {
    logger.error(e);
  }
}
* */


const winston = require('winston');
const DailyRotateFile = require('winston-daily-rotate-file');

const { NODE_ENV, root } = require('../../config/environment');

const logger = new winston.Logger({
  transports: [
    new DailyRotateFile({
      datePattern: 'YYYY-MM-DD-HH',
      filename: `${root}/logs/error.%DATE%.log`,
    }),
    new (winston.transports.Console)({
      name: 'console',
      level: 'debug',
      silent: NODE_ENV === 'production',
    }),
  ],
});

module.exports = logger;
