How to use the levels function from log4js

Find comprehensive JavaScript log4js.levels code examples handpicked from public code repositorys.

166
167
168
169
170
171
172
173
174
// starts listening to requests as reported in issue #158. Not installing the log4js connect
// logger when the log level has a higher severity than INFO since it would not log at that level
// anyway.
if (!(settings.loglevel === 'WARN' && settings.loglevel === 'ERROR')) {
  app.use(log4js.connectLogger(logger, {
    level: log4js.levels.DEBUG,
    format: ':status, :method :url',
  }));
}
fork icon0
star icon0
watch icon0

+ 2 other calls in file

2
3
4
5
6
7
8
9
10
11
12
13
 */


const log4js = require('log4js')


const levels = {
    'trace': log4js.levels.TRACE,
    'debug': log4js.levels.DEBUG,
    'info': log4js.levels.INFO,
    'warn': log4js.levels.WARN,
    'error': log4js.levels.ERROR,
fork icon0
star icon0
watch icon0

+ 29 other calls in file

32
33
34
35
36
37
38
39
40
- status code rulesets

For example:

```javascript
app.use(log4js.connectLogger(logger, { level: log4js.levels.INFO, format: ':method :url' }));
```

or:
fork icon0
star icon0
watch icon3