其他分享
首页 > 其他分享> > log4js基本使用

log4js基本使用

作者:互联网

const log4js = require("log4js");
log4js.configure({
  appenders: { cheese: { type: "file", filename: "cheese.log" } },
  categories: { default: { appenders: ["cheese"], level: "info" } }
});
 
const logger = log4js.getLogger("cheese");
logger.trace("Entering cheese testing");
logger.debug("Got cheese.");
logger.info("Cheese is Comté.");
logger.warn("Cheese is quite smelly.");
logger.error("Cheese is too ripe!");
logger.fatal("Cheese was breeding ground for listeria.");

标签:基本,cheese,const,appenders,Cheese,使用,logger,log4js
来源: https://blog.csdn.net/new______object/article/details/117574307