HOME 개발팁 폴더 로그 기록함수

프로그램 작업하다 좋은 팁, 정보, 테스트를 기록하는 곳입니다.


node | 폴더 로그 기록함수

페이지 정보

작성자 굿스웹 작성일20-02-25 15:04 조회685회 댓글0건

본문

function saveLog (nick, command) {
var dt = new Date();
var today = dt.toFormat('YYYY-MM-DD');
var todaytime = dt.toFormat('YYYY-MM-DD HH24:MI:SS');
    var file = 'log/' + nick + '_' + today + '.log';
    var datetime = '[' + todaytime + '] : ';
    var text = datetime + command + '\r\n';
    fs.appendFile(file, text, function (err) {
        if (err) return console.log(err);
        //console.log('successfully appended : ' + text + '');
    });
}




var fs = require('fs');


function quicklog(s) {
    var logpath = "log/api_quick.log";
    var fs = require('fs');
    s = s.toString().replace(/\r\n|\r/g, '\n'); // hack
    var fd = fs.openSync(logpath, 'a+', 0666);
    fs.writeSync(fd, s + '\n');
    fs.closeSync(fd);
}

quicklog('11')




var winston = require('winston');
  require('winston-daily-rotate-file');
 
  var transport = new (winston.transports.DailyRotateFile)({
    filename: 'log/application-%DATE%.log',
    datePattern: 'YYYY-MM-DD-HH',
    zippedArchive: true,
    maxSize: '20m',
    maxFiles: '14d'
  });
 
  transport.on('rotate', function(oldFilename, newFilename) {
    // do something fun
  });
 
  var logger = winston.createLogger({
    transports: [
      transport
    ]
  });
 
  logger.info('Hello World!');

  /*
  npm install winston-daily-rotate-file
 
  */

[주소복사] https://www.goodsweb.kr/?u=D41JZ9G9
SNS 알리기
핀터레스트
텔레그램로
블로그로
카카오스토리
카톡 공유

관련 블로그
로딩중


5명  IP : 3.23.♡.209
001 3.♡.92.209 비밀번호 입력
(/bbs/password.php?w=s&bo_table=tip&wr_id=175&sca=python&page=2)
002 222.♡.104.207 굿스웹 - 홈페이지 유지보수 관리
(/)
003 34.♡.82.77 네이버 연관 채널 등록방법 - 개발팁
(/bbs/board.php?bo_table=tip&wr_id=32)
004 216.♡.66.232 사이트 웹 페이지가 검색에 수집 노출되지 않을때 robots.txt - 개발팁
(/bbs/board.php?bo_table=tip&wr_id=14&sca=%EA%B8%B0%ED%83%80)
005 18.♡.156.50 오류안내 페이지
(/bbs/download.php?bo_table=tip&wr_id=229&no=1&sca=node)

접속자
  • 오늘 : 245
  • 어제 : 296
  • 최대 : 874
  • 전체 : 407,894

검색로봇(Robots) 최근 방문시간
  • NAVER : 7시간 전
  • GOOGLE : 21시간 전
  • BING : 3일 전
  • DAUM : 4일 전

ETH : 0x8abf3B748ab78828AE07685e4fd53d1a606f18D3



페이스북 네이버 블로그 굿스웹 쇼핑몰 네이버 카페 굿스웹 트위터 굿스웹 티스토리 Google Play