Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/volt1c/emoji-logs

This is npm package add emoji prefixes to your specified console logs
https://github.com/volt1c/emoji-logs

console console-log debug debugging javascript js log logging logs npm-package package yarn-package

Last synced: 10 days ago
JSON representation

This is npm package add emoji prefixes to your specified console logs

Awesome Lists containing this project

README

        

# emoji-logs

Emoji-logs is a zero-dependency module that marks certain console logs with emoji.

## Install

```bash
npm install emoji-logs
yarn add emoji-logs
```

## Usage

As early as possible in your application, require and configure emoji-logs.

```js
// CommonJS
require('emoji-logs').config({})

// JavaScript modules
import emojiLogs from 'emoji-logs'

emojiLogs.configure({})
```

## Config

### Change emoji

```js
require('emoji-logs').config({
info: '๐Ÿงถ',
debug: '๐Ÿ”ง',
warn: '๐Ÿ”ฅ',
error: '๐Ÿ’ฅ',
})
```

### Change Formatter
```js
const moment = require('moment')

require('emoji-logs').config({
formatter: (v) => {
const time = moment(new Date()).format('HH:MM:SS')
return `[${time}] ${v}>`
}
})
```

## Example

### Default configuration

![example](./assets/default.gif)

### Changed emojis

![example](./assets/configured.gif)

### Changed formatter

![example](./assets/formatter.gif)