"use strict";
var path = require('path')
, log4js = require('../lib/log4js');
log4js.configure(
, ,
]});
var logger = log4js.getlogger('things');
logger.debug("this little thing went to market");
logger.info("this little thing stayed at home");
logger.error("this little thing had roast beef");
logger.fatal("this little thing had none");
logger.trace("and this little thing went wee, wee, wee, all the way home.");
使用rotating-file-stream
var path = require('path');
var fs = require('fs');
var rfs = require('rotating-file-stream');
var logdirectory = __dirname;
function wpad(num)
/** * [wgenerator 建立檔名函式]
* @author wdd
* @datetime 2017-02-22t10:13:39+0800
* 日誌會保留乙個月的:因為日誌檔名是只使用日期,9月8號的日誌就會覆蓋8月8號的日誌
* 檔案的格式是gzip
* 檔名例如:22-log.gizp
*/function wgenerator(time, index)
return "/storage/"+ wpad(time.getdate()) +"-log.txt.gzip";
}var accesslogstream = rfs(wgenerator, );
/** * [exports description]
* @author wdd
* @datetime 2017-02-22t10:24:06+0800
* 使用方式:
* 1. 安裝rotating-file-stream
* 2. 在根目錄下建立乙個資料夾,例如logs。然後把access-log.js放進去
* 5. 日誌檔案會自動生成在./logs/storage資料夾下面,當天的日誌會儲存在暫存的./logs/temp-log.gzip裡
*/module.exports = function(req, res, next));
next();
};
自定義日誌工具
import android.util.log created by xiongxl on 2017 2 20.public class logutil public static void d string tag,string msg public static void i string ta...
自定義日誌檔案
借用 部落格 usr bin python coding utf 8 importlogging importos.path importtime 自定義日誌類 classlogger object def init self,logger 指定儲存日誌的檔案路徑,日誌級別,以及呼叫檔案 將日誌存入...
fso自定義日誌
registeruserfunc webedit set writelog webedit set function writelog webedit set object,setvalue object.set setvalue 執行原來的設定值的步驟 定義i o模式 const forreadi...