text: // 날짜별로 저장하는 기능
  // winston-daily-rotate-file
  
  const { createLogger, transports, format } = require('winston');
  const { combine, timestamp, label, printf, simple, colorize } = format;
  
  const printFormat = printf(({ timestamp, label, level, message }) => {
    return `${timestamp} [${label}] ${level} : ${message}`;
  });
  
  const printLogFormat = {
    file: combine(
      label({
        label: '백엔드 연습',
      }),
      timestamp({
        format: 'YYYY-MM-DD HH:mm:dd',
      }),
      printFormat
    ),
    console: combine(colorize(), simple()),
  };
  
  const opts = {
    file: new transports.File({
      filename: 'access.log',
      dirname: './logs',
      level: 'info',
      format: printLogFormat.file,
    }),
    console: new transports.Console({
      level: 'info',
      format: printLogFormat.console,
    }),
  };
  
  const logger = createLogger({
    transports: [opts.file],
  });
  
  if (process.env.NODE_ENV !== 'production') {
    logger.add(opts.console);
  }
  
  // morgan
  logger.stream = {
    write: message => logger.info(message),
  };
  // morgan
  
  module.exports = logger;
  