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
import debug from 'debug'
import isBrowser from './isBrowser'
if (isBrowser() && process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
// Heads Up!
// https://github.com/visionmedia/debug/pull/331
//
// debug now clears storage on load, grab the debug settings before require('debug').
// We try/catch here as Safari throws on localStorage access in private mode or with cookies disabled.
let DEBUG
try {
DEBUG = window.localStorage.debug
} catch (e) {
/* eslint-disable no-console */
console.error('Semantic-UI-React could not enable debug.')
console.error(e)
/* eslint-enable no-console */
}
// enable what ever settings we got from storage
debug.enable(DEBUG)
}
const makeDebugger = namespace => debug(`semanticUIReact:${namespace}`)
export default makeDebugger