https://github.com/artyomxx/pdlog
🙈 Yet another JS log module with prefixes made of a custom string and a timestamp (no deps!)
https://github.com/artyomxx/pdlog
date debug error javascript js log module prefix warn
Last synced: 2 months ago
JSON representation
🙈 Yet another JS log module with prefixes made of a custom string and a timestamp (no deps!)
- Host: GitHub
- URL: https://github.com/artyomxx/pdlog
- Owner: artyomxx
- License: mit
- Created: 2017-07-31T14:33:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-10T11:26:18.000Z (over 8 years ago)
- Last Synced: 2026-01-14T09:00:27.708Z (3 months ago)
- Topics: date, debug, error, javascript, js, log, module, prefix, warn
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
## pdlog
Yet another JS log module with prefixes made of a custom string and a timestamp.
---
### Installation:
`npm i --save pdlog`
### Usage:
```js
const c = require('pdlog')('#WHATEVER');
c.log('hello world');
```
_Output:_
```
[2017-07-31T15:49:57.161Z] #WHATEVER hello world
```
### Methods:
- log()
- error()
- warn()
- info()
- debug()
### Custom prefix function (well, why not!)
```js
const c = require('pdlog')(() => Date.now())
c.log('hello world');
```
_Output:_
```
685051200000 hello world
```
_* function's result will be used without the built-in date prefix_
### Options:
#### quiet: ``
**Why function?** Because you probably want to have an ability to switch it on or off dynamically.
```js
let quietMode = false;
const c = require('pdlog')('quiet check', {quiet: () => quietMode});
c.log('you will see this');
quietMode = true;
c.log('you will not see this');
```