https://github.com/maradotwebp/outputjs
:pencil: A simplistic node.js logger.
https://github.com/maradotwebp/outputjs
logger logging nodejs nodejs-modules output
Last synced: about 2 months ago
JSON representation
:pencil: A simplistic node.js logger.
- Host: GitHub
- URL: https://github.com/maradotwebp/outputjs
- Owner: maradotwebp
- License: mit
- Created: 2017-08-10T14:54:46.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-08T13:08:06.000Z (about 7 years ago)
- Last Synced: 2025-03-18T10:57:42.355Z (over 1 year ago)
- Topics: logger, logging, nodejs, nodejs-modules, output
- Language: JavaScript
- Size: 33.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# outputjs
[](https://badge.fury.io/js/outputjs)

[](https://raw.githubusercontent.com/froehlichA/outputjs/master/LICENSE)
[](https://greenkeeper.io/)
[](https://travis-ci.org/froehlichA/outputjs)
[](https://codecov.io/gh/froehlichA/outputjs)
:pencil: A simplistic node.js logger that can be configured to the max.

* No configuration necessary!
* Name & Color support!
* Automatic padding!
* Info, Success, Error, and warn functions!
* A debug function that can be toggled!
* Automatic name & color selection!
## Usage
You can choose to either pass options as an argument...
```javascript
const logger = require('outputjs');
const chalk = require('chalk');
const options = {
name: 'server', //Name of the logger. Will be displayed in [] tags. DEFAULT: Name of caller file
color: chalk.bgGreen, //Color used for highlighting the name. DEFAULT: random unique color
padding: 10, //Padding with x width for the name. DEFAULT: 10
prefix: '-->', //Prefix used after the name. DEFAULT: "->"
debug: true, //Enables output with .debug() DEFAULT: false
debugPrefix: 'D: ', //Prefix used for debugging. DEFAULT: "DEBUG:"
filePath: 'output.js' //Outputs everything to a file. Doesn't support colors. DEFAULT: false
}
const server = new logger(options);
```
...or simple go with no configuration at all.
```javascript
const logger = require('outputjs');
const server = new logger();
```
The following functions are available to you:
```javascript
server.debug("A debug message! Without debug set to true, it won't display. Highlighted in bright yellow.");
server.info("A info message! Highlighted in white.");
server.success("A success message! Highlighted in green.");
server.warn("A warn message! Highlighted in yellow.");
server.error("A error message! Highlighted in red.");
```