napi-addon-spdlog
v0.0.17
Published
Using node addon API to extend spdlog
Downloads
22
Readme
napi-addon-spdlog
This NPM package is suitable for Linux and windows, and C + + environment is required under windows. And it is suitable for node8.0 and above. Be careful, the message passed in must be of type string. otherwise, an error is thrown.
Example
const addon_logger = require("napi-addon-spdlog");
addon_logger.setLevel(addon_logger.LOGLEVEL.TRACE);
addon_logger.setFormatter("[%H:%M:%S] [%l] -%v");
// for rotating logger
const rotatingLogger = new addon_logger.RotatingLogger("test", "./logs/rotating.log", 30 * 1024 * 1024, 5);
rotatingLogger.info("This is test file!");
// for daily logger, and The log file was created at 2:30 pm
const dailyLogger = new addon_logger.DailyLogger("test", "./logs/all.log", 2, 30);
dailyLogger.info("This is test file!");