
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
Simple console log for NodeJs with colors and timestamp. 0 dependencies.

$ npm install logdc
$ yarn add logdc
const log = require(logdc);
log.info('Lorem Ipsum', {foo: ['bar']}, [1, 2, 3], 'Dolorem');
$[19:15:46] INFO : 'Lorem Ipsum', { foo: [ 'bar' ] }, [ 1, 2, 3 ], 'Dolorem'
// code
log.info('Lorem Ipsum');
log.warn('Lorem Ipsum');
log.error('Lorem Ipsum');
log.success('Lorem Ipsum');
log.log('Lorem Ipsum');
log.br();
// console:
$[19:15:46] INFO : 'Lorem Ipsum'
$[19:15:46] WARN : 'Lorem Ipsum'
$[19:15:46] ERROR : 'Lorem Ipsum'
$[19:15:46] SUCCESS : 'Lorem Ipsum'
$[19:15:46] LOG : 'Lorem Ipsum'
$[19:15:46] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
log.br();
$[19:15:46] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
To change separator character override default settings for label br.
Override default settings or create new labels in your package.json file.
Add logdcConfig node:
"logdcConfig": {
"labels": {
"foo": {
"color": "red",
"text": "My Custom label"
},
"warn": {
"color": "green",
"text": "Do not warn me!"
}
},
"time": true,
"counter": 2,
"equal": true
}
1.1. Hide labels
"logdcConfig": {
"labels": false
}
log.info('Lorem Ipsum');
$[19:19:25] 'Lorem Ipsum'
1.2. Add custom labels, or override default
"logdcConfig": {
"labels": {
"foo": {
"color": "red",
"text": "My Custom label"
},
"warn": {
"color": "green",
"text": "Do not warn me!"
}
}
}
log.foo('Lorem Ipsum');
$[19:15:46] FOO : 'Lorem Ipsum'
log.warn('Lorem Ipsum');
$[19:15:46] DO NOT WARN ME! : 'Lorem Ipsum'
1.3. Equal length
Length of labels (type name + spaces + ':') is equal to longest type name (default 8 SUCCESS :),
so that colon is always at the same vertical position. To disable this behaviour set equal as false
"logdcConfig": {
"equal": false
}
log.info('Lorem Ipsum');
log.error('Lorem Ipsum');
// console
$[19:15:46] INFO: 'Lorem Ipsum'
$[19:15:46] ERROR: 'Lorem Ipsum'
To hide timestamp set time to false
"logdcConfig": {
"time": false
}
log.info('Lorem Ipsum');
$INFO : 'Lorem Ipsum'
Label name has color.
Config counter is defining number of logged arguments to colorize, default is 2, or colorize label and first argument.
3.1. To disable colors pass set counter as 0
"logdcConfig": {
"counter": 0
}
log.info('Lorem Ipsum');
$[19:15:46] INFO : 'Lorem Ipsum'
3.2. To add colors to other logged parameters increase counter (1 is for label)
"logdcConfig": {
"counter": 4
}
log.info('Lorem Ipsum', {foo: 'bar'}, 'Third param');
$[19:15:46] INFO : 'Lorem Ipsum', { foo: 'bar' }, 'Third param'
3.3. To change color of default label set labels with default type as key:
"logdcConfig": {
"labels": {
"error": {
"color": "white",
"text": "No errors"
},
"warn": {
"color": "green",
"text": "Do not warn me!"
}
}
}
log.error('Lorem Ipsum');
$[19:15:46] NO ERRORS : 'Lorem Ipsum'
"logdcConfig": {
"labels": {
"log": {
"color": "white",
"text": "log"
},
"info": {
"color": "white",
"text": "info"
},
"warn": {
"color": "yellow",
"text": "warning"
},
"error": {
"color": "red",
"text": "error"
},
"success": {
"color": "green",
"text": "success"
},
"br": {
"color: "white",
"text": ":"
}
},
"time": true,
"counter": 2,
"equal": true
}

log.info('Lorem Ipsum', {foo: ['bar']}, [1, 2, 3], 'Dolorem')
$[17:03:26] INFO : 'Lorem Ipsum', { foo: [ 'bar' ] }, [ 1, 2, 3 ], 'Dolorem'
log.warn('Lorem Ipsum', {foo: ['bar']}, [1, 2, 3], 'Dolorem')
$[17:03:26] WARN : 'Lorem Ipsum', { foo: [ 'bar' ] }, [ 1, 2, 3 ], 'Dolorem'
log.error('Lorem Ipsum', {foo: ['bar']}, [1, 2, 3], 'Dolorem')
$[17:03:26] ERROR : 'Lorem Ipsum', { foo: [ 'bar' ] }, [ 1, 2, 3 ], 'Dolorem'
log.success('Lorem Ipsum', {foo: ['bar']}, [1, 2, 3], 'Dolorem')
$[17:03:26] SUCCESS : 'Lorem Ipsum', { foo: [ 'bar' ] }, [ 1, 2, 3 ], 'Dolorem'
log.log('Lorem Ipsum', {foo: ['bar']}, [1, 2, 3], 'Dolorem')
$[17:03:26] LOG : 'Lorem Ipsum', { foo: [ 'bar' ] }, [ 1, 2, 3 ], 'Dolorem'
log.br()
$[17:03:26] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FAQs
Simple console log for NodeJs with colors and timestamp
We found that logdc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.