Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ronniechong/logger
Console logger for node and browser environment
https://github.com/ronniechong/logger
Last synced: about 1 month ago
JSON representation
Console logger for node and browser environment
- Host: GitHub
- URL: https://github.com/ronniechong/logger
- Owner: ronniechong
- License: mit
- Created: 2020-04-13T07:16:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:23:27.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T18:25:33.377Z (2 months ago)
- Language: JavaScript
- Size: 3.29 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @digitalronin/logger
![NPM](https://img.shields.io/npm/l/@digitalronin/logger)
[![npm (scoped)](https://img.shields.io/npm/v/@digitalronin/logger)](https://npmjs.org/package/@digitalronin/logger "View this project on npm")
[![Build Status](https://travis-ci.org/ronniechong/logger.svg?branch=master)](https://travis-ci.com/ronniechong/logger)A simple wrapper for `console.log` for Node or browser. The former supports colors, using `chalk` [Link](https://github.com/chalk/chalk)
## Installation
```bash
# Using Yarn
> yarn add @digitalronin/logger --dev# Using NPM
> npm install @digitalronin/logger -D
```## Usage
### Browser
```javascript
const Logger = require('@digitalronin/logger');
const l = new Logger();// console.log
l.log('Test log');// console.error
l.error('Test error');// console.log
l.info('Test info');
```### Node
```javascript
const Logger = require('@digitalronin/logger');
const l = new Logger();// console.log in white
l.log('Test log');// console.log in red
l.error('Test error');// console.log in blue
l.info('Test info');
```#### Overwriting default colors
Only the following [colors](https://github.com/chalk/chalk#colors) is supported
```javascript
const Logger = require('@digitalronin/logger');
const l = new Logger({
error: 'blue',
info: 'white',
log: 'green',
});
```