File: README.md

package info (click to toggle)
node-copy-webpack-plugin 5.1.2%2B~cs9.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,480 kB
  • sloc: javascript: 6,677; makefile: 5
file content (132 lines) | stat: -rw-r--r-- 3,392 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<div align="center">
  <a href="https://github.com/webpack/webpack">
    <img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
  </a>
</div>

[![npm][npm]][npm-url]
[![node][node]][node-url]
[![deps][deps]][deps-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![chat][chat]][chat-url]

# webpack-log

A common logging module for the Webpack ecosystem. `webpack-log` leverages
[`loglevelnext`][loglevelnext].

## Getting Started

First thing's first, install the module:

```console
npm install webpack-log --save
```

_Note: We do not recommend installing this module globally._

## Requirements

`webpack-log` requires Node v6 or higher.

## Usage

```js
const weblog = require('webpack-log');
const log = weblog({ name: 'wds' }) // webpack-dev-server

log.info('Server Starting');
```

The code above will produce:

![output](output.png)

## Options

The default export (`function`) will return a logger, given an `options` Object.
The following is a property reference for the Object.

_Note: the logger returned is unique by default, due to the nature of the `webpack`
ecosystem. Please reference the [`unique`](#unique) option below for disabling
this feature and to force caching._

### level

Type: `String`  
Default: `'info'`

Specifies the level the logger should use. A logger will not produce output for
any log level _beneath_ the specified level. Available levels and order are:

```js
[
  'trace',
  'debug',
  'info',
  'warn',
  'error',
  'silent'
]
```

_Note: The level names shown above correspond to the available logging methods,
with the notable exception of the `silent` level._

### name

_Required_  
Type: `String`  
Default: `'<unknown>'`

Specifies the name of the log to create. This property is required, and used to
differentiate between loggers when `webpack-log` is used in multiple projects
executing in the same process space.

### timestamp

Type: `Boolean`  
Default: `false`

If `true`, instructs the logger to display a timestamp for log output, preceding
all other data.

### unique

Type: `Boolean`  
Default: `true`

If `false`, instructs the logger to used cached versions of a log with the same
name. Due to the nature of the `webpack` ecosystem and multiple plugin/loader
use in the same process space, loggers are created as unique instances by default.
By passing `false` for this property, the module is instructed to cache the
requested logger.

## Contributing

We welcome your contributions! Please have a read of [CONTRIBUTING.md](CONTRIBUTING.md) for more information on how to get involved.

## License

#### [MIT](./LICENSE)

[npm]: https://img.shields.io/npm/v/webpack-log.svg
[npm-url]: https://npmjs.com/package/webpack-log

[node]: https://img.shields.io/node/v/webpack-log.svg
[node-url]: https://nodejs.org

[deps]: https://david-dm.org/webpack-contrib/webpack-log.svg
[deps-url]: https://david-dm.org/webpack-contrib/webpack-log

[tests]: http://img.shields.io/travis/webpack-contrib/webpack-log.svg
[tests-url]: https://travis-ci.org/webpack-contrib/webpack-log

[cover]: https://codecov.io/gh/webpack-contrib/webpack-log/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack-contrib/webpack-log

[chat]: https://badges.gitter.im/webpack/webpack.svg
[chat-url]: https://gitter.im/webpack/webpack

[loglevelnext]: https://github.com/shellscape/loglevelnext