How to use the enableAll function from loglevel

Find comprehensive JavaScript loglevel.enableAll code examples handpicked from public code repositorys.

24
25
26
27
28
29
30
31
32
33

### Convenient

* Log output keeps line numbers: most JS logging frameworks call console.log methods through wrapper functions, clobbering your stacktrace and making the extra info many browsers provide useless. We'll have none of that thanks.
* It works with all the standard JavaScript loading systems out of the box (CommonJS, AMD, or just as a global)
* Logging is filtered to "warn" level by default, to keep your live site clean in normal usage (or you can trivially re-enable everything with an initial log.enableAll() call)
* Magically handles situations where console logging is not initially available (IE8/9), and automatically enables logging as soon as it does become available (when developer console is opened)
* Extensible, to add other log redirection, filtering, or formatting functionality, while keeping all the above (except you will clobber your stacktrace, see Plugins below)

## Downloading loglevel
fork icon170
star icon0
watch icon4

11
12
13
14
15
16
17
18
19
20
  INFO: chalk.cyan,
  WARN: chalk.yellow,
  ERROR: chalk.red,
};
logPrefix.reg(log);
log.enableAll();
if (process.env.LOGLEVEL === 'DEBUG') {
  log.setLevel(log.levels.DEBUG);
} else {
  log.setLevel(log.levels.INFO);
fork icon10
star icon7
watch icon0

72
73
74
75
76
77
78
79
80
81
  INFO: chalk.blue,
  WARN: chalk.yellow,
  ERROR: chalk.red
}
prefix.reg(mlog)
mlog.enableAll()

prefix.apply(mlog, {
  format (level, name, timestamp) {
    let tlevel = level
fork icon0
star icon2
watch icon2

4
5
6
7
8
9
10
11
12
13
14
import pollsPage from "@/views/polls"
import showPoll from "@/views/poll-show"
import api from "@/services/liquido-graphql-client"
import config from "config"
const log = require("loglevel")
if (process.env.NODE_ENV === "development") log.enableAll()


const routes = [
	{
		path: "/",
fork icon1
star icon1
watch icon0