2.0.0 โข Published 11 months ago
logging-pretty v2.0.0
๐ป Step to install :
npm install logging-pretty
โ๏ธ Example :
const { loggingPretty } = require(`..`);
/**
*
* @param pathFile [optional] example "./db.log" if path dont have file, script will create and write new file
* @param force [optional] force mode, if "pathFile" is set but this is set to "console" it will not write to the log file.
* @param formatTime [optional] set format date time like YYYY-MM-DD HH:mm:ss.
* @param ovrRenderLog [optional] override function for render log.
* @param ovrWriteLog [optional] override function for write log in file.
* @returns object
*/
const log = loggingPretty(
`./test/store.log`,
`all`,
`YYYY-MM-DD HH:mm:ss`,
({ strTime, strTag, strStyleTag, strStyleMsg }) => {
// override render log
if (strTag == `INFO`)
console.log(`[${strTime}] ${strStyleTag}: -> -> ${strStyleMsg}`);
if (strTag == `FAIL`)
console.log(`[${strTime}] ${strStyleTag}: x x ${strStyleMsg}`);
}
);
log.info(`info task`); // [2024-07-14 17:46:32] INFO: -> -> info task
log.fail(`fail task`); // [2024-07-14 17:46:32] FAIL: x x fail task
๐งพ Pre-Requisistes :
- node.js / bun.js / deno.js
- (optional) typescript
- (optional) commonJS
- (optional) ESM
๐ License :
Licensed see here
2.0.0
11 months ago
1.8.8
1 year ago
1.8.4
1 year ago
1.7.2
1 year ago
1.8.0
1 year ago
1.7.1
1 year ago
1.6.8
1 year ago
1.6.7
1 year ago
1.6.6
1 year ago
1.6.4
1 year ago
1.6.3
1 year ago
1.6.2
1 year ago
1.6.1
1 year ago
1.6.0
1 year ago
1.5.0
2 years ago
1.2.0
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago