https://github.com/damartripamungkas/logging-pretty
๐ฅ๏ธ Logging your message with pretty color in node.js
https://github.com/damartripamungkas/logging-pretty
console-log debugging javascript logger logging logging-library logging-pretty nodejs npm-package
Last synced: 24 days ago
JSON representation
๐ฅ๏ธ Logging your message with pretty color in node.js
- Host: GitHub
- URL: https://github.com/damartripamungkas/logging-pretty
- Owner: damartripamungkas
- License: mit
- Created: 2023-01-07T18:23:57.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-05-14T11:49:06.000Z (5 months ago)
- Last Synced: 2025-05-14T14:52:45.404Z (5 months ago)
- Topics: console-log, debugging, javascript, logger, logging, logging-library, logging-pretty, nodejs, npm-package
- Language: TypeScript
- Homepage: https://npmjs.com/package/logging-pretty
- Size: 103 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
LOGGING-PRETTY
### ๐ป Step to install :
```
npm i logging-pretty
```### โ๏ธ Example :
```typescript
import { LoggingPretty } from "logging-pretty"/**
*
* @param force [optional] force mode, if "pathFile" is set but this is set to "console" it will not write to the log file.
* @param pathFile [optional] set path file for store log.
* @param formatTime [optional] set format date time like YYYY-MM-DD HH:mm:ss.
* @returns object
*/
const log = new LoggingPretty({
force: `all`,
pathFile: `./test/store.log`,
formatTime: `YYYY-MM-DD HH:mm:ss`
})log._renderLogToConsole = ({ 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](./LICENSE)