Skip to content

Commit

Permalink
update devdeps and required set DEBUG_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
lagden committed Jun 11, 2018
1 parent d97c1c8 commit 900a61a
Show file tree
Hide file tree
Showing 6 changed files with 3,071 additions and 3,388 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: node_js
node_js:
- "7.6"
after_script: npm run coverage
- "8"
- "10"
script: "npm run test-cov"
after_script: "npm i coveralls@3.0.1 && npm run report"
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ $ npm i -S @tadashi/debug

The API is the same of https://github.com/visionmedia/debug

**Attention**
You can set your prefix, default is: `tadashi-debug`

## Environment Variables

## Usage
**Attention**

You must set an environment variables `DEBUG_NAME`
Default is: `tadashi-debug`

Using the follow code: **sample.js**

## Usage

```js
'use strict'

const debug = require('@tadashi/debug')
const {log, error, info, warn} = debug('my-api')
const {log, error, info, warn} = require('@tadashi/debug')

// log
log('Apenas um show')
Expand Down
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

const _debug = require('debug')

function debug(prefix = 'tadashi-debug') {
const {DEBUG_NAME = 'tadashi-debug'} = process.env

function debug(prefix) {
const log = _debug(`${prefix}:log`)
const info = _debug(`${prefix}:info`)
const warn = _debug(`${prefix}:warn`)
Expand All @@ -25,4 +27,4 @@ function debug(prefix = 'tadashi-debug') {
}
}

module.exports = debug
module.exports = debug(DEBUG_NAME)

0 comments on commit 900a61a

Please sign in to comment.