Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f)
This commit is contained in:
commit
28ccc3db2d
13974 changed files with 2618436 additions and 0 deletions
21
node_modules/console-log-level/LICENSE
generated
vendored
Normal file
21
node_modules/console-log-level/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2019 Thomas Watson Steen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
63
node_modules/console-log-level/README.md
generated
vendored
Normal file
63
node_modules/console-log-level/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# console-log-level
|
||||
|
||||
A dead simple logger. Will log to STDOUT or STDERR depending on the
|
||||
chosen log level. It uses `console.info`, `console.warn` and
|
||||
`console.error` and hence supports the same API.
|
||||
|
||||
Log levels supported: trace, debug, info, warn, error and fatal.
|
||||
|
||||
[](https://www.npmjs.com/package/console-log-level)
|
||||
[](https://travis-ci.org/watson/console-log-level)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install console-log-level
|
||||
```
|
||||
|
||||
## Example usage
|
||||
|
||||
```js
|
||||
var log = require('console-log-level')({ level: 'info' })
|
||||
|
||||
log.trace('a') // will not do anything
|
||||
log.debug('b') // will not do anything
|
||||
log.info('c') // will output 'c\n' on STDOUT
|
||||
log.warn('d') // will output 'd\n' on STDERR
|
||||
log.error('e') // will output 'e\n' on STDERR
|
||||
log.fatal('f') // will output 'f\n' on STDERR
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
Configure the logger by passing an options object:
|
||||
|
||||
```js
|
||||
var log = require('console-log-level')({
|
||||
prefix: function (level) {
|
||||
return new Date().toISOString()
|
||||
},
|
||||
level: 'info'
|
||||
})
|
||||
```
|
||||
|
||||
### level
|
||||
|
||||
A `string` to specify the log level. Defaults to `info`.
|
||||
|
||||
### prefix
|
||||
|
||||
Specify this option if you want to set a prefix for all log messages.
|
||||
This must be a `string` or a `function` that returns a string.
|
||||
|
||||
Will get the level of the currently logged message as the first
|
||||
argument.
|
||||
|
||||
### stderr
|
||||
|
||||
A `boolean` to log everything to stderr. Defauls to `false`.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
46
node_modules/console-log-level/index.js
generated
vendored
Normal file
46
node_modules/console-log-level/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
'use strict'
|
||||
|
||||
var util = require('util')
|
||||
|
||||
var levels = ['trace', 'debug', 'info', 'warn', 'error', 'fatal']
|
||||
var noop = function () {}
|
||||
|
||||
module.exports = function (opts) {
|
||||
opts = opts || {}
|
||||
opts.level = opts.level || 'info'
|
||||
|
||||
var logger = {}
|
||||
|
||||
var shouldLog = function (level) {
|
||||
return levels.indexOf(level) >= levels.indexOf(opts.level)
|
||||
}
|
||||
|
||||
levels.forEach(function (level) {
|
||||
logger[level] = shouldLog(level) ? log : noop
|
||||
|
||||
function log () {
|
||||
var prefix = opts.prefix
|
||||
var normalizedLevel
|
||||
|
||||
if (opts.stderr) {
|
||||
normalizedLevel = 'error'
|
||||
} else {
|
||||
switch (level) {
|
||||
case 'trace': normalizedLevel = 'info'; break
|
||||
case 'debug': normalizedLevel = 'info'; break
|
||||
case 'fatal': normalizedLevel = 'error'; break
|
||||
default: normalizedLevel = level
|
||||
}
|
||||
}
|
||||
|
||||
if (prefix) {
|
||||
if (typeof prefix === 'function') prefix = prefix(level)
|
||||
arguments[0] = util.format(prefix, arguments[0])
|
||||
}
|
||||
|
||||
console[normalizedLevel](util.format.apply(util, arguments))
|
||||
}
|
||||
})
|
||||
|
||||
return logger
|
||||
}
|
||||
42
node_modules/console-log-level/package.json
generated
vendored
Normal file
42
node_modules/console-log-level/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"author": {
|
||||
"name": "Thomas Watson Steen",
|
||||
"email": "w@tson.dk"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/watson/console-log-level/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"coordinates": [
|
||||
55.778253,
|
||||
12.593208
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "The most simple logger imaginable",
|
||||
"devDependencies": {
|
||||
"standard": "^12.0.1",
|
||||
"tape": "^4.10.1"
|
||||
},
|
||||
"homepage": "https://github.com/watson/console-log-level",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"logger",
|
||||
"console",
|
||||
"console.log",
|
||||
"stdout",
|
||||
"stderr"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "console-log-level",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/watson/console-log-level.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test.js"
|
||||
},
|
||||
"version": "1.4.1"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue