15.0.0 • Published 2 years ago

nightingale-browser-console v15.0.0

Weekly downloads
92
License
ISC
Repository
github
Last release
2 years ago

Install

npm install --save nightingale-browser-console

Usage

import { configure, levels } from 'nightingale';
import { ConsoleHandler } from 'nightingale-browser-console';

configure([{ handlers: [new ConsoleHandler(Level.INFO)] }]);

Theme

If you have a dark console theme, you can set this config in your localStorage :

localStorage.NIGHTINGALE_THEME = 'dark';

You can also force this option:

import { ConsoleHandler } from 'nightingale-browser-console';

configure([{ handlers: [new ConsoleHandler(Level.INFO, { theme: 'dark' })] }]);

Debug

with localStorage

localStorage.debug = '*'; // debug everything
localStorage.debug = 'app'; // debug for logger with key 'app'
localStorage.debug = 'app,nightingale'; // debug for logger with key 'app' and 'nightingale'
localStorage.debug = '/^app/'; //debug for logger with key starting with 'app'
localStorage.debug = '/^(app|nightingale$)/'; // debug for logger with key starting with 'app' and key 'nightingale'
localStorage.debug = '*,-app'; // debug everything except app
localStorage.debug = '*,-app:*'; // debug everything except app and all its children

with query, in the url

?DEBUG='*'; // debug everything
?DEBUG=app // debug for logger with key 'app'
?DEBUG=app,nightingale // debug for logger with key 'app' and 'nightingale'
?DEBUG=/^app/  // debug for logger with key starting with 'app'
?DEBUG=/^(app|nightingale$)/  // debug for logger with key starting with 'app' and key 'nightingale'
?DEBUG=*,-app // debug everything except app
?DEBUG=*,-app:* // debug everything except app and all its children

Use source maps to display error stack trace

In production:

Send your log to an external tool like sentry. Sentry allows you to send the source maps after building (if you use webpack, you can use hidden-source-map to generate .map files, send them to sentry, and remove them so they are not accessible).

In development:

  • Configure your build tool to generate sourcemaps. For webpack: use proper devtool configuration. For best stack trace, use source-map but it's the slowest option.
  • Make sure your project uses source-map-support or similar tool. If not, you can install and simply import source-map-support/register.
15.0.0

2 years ago

14.2.0

2 years ago

14.2.1

2 years ago

14.1.0

2 years ago

14.0.0

2 years ago

14.0.1

2 years ago

14.0.2

2 years ago

13.0.0

3 years ago

12.1.2

4 years ago

12.1.3

3 years ago

12.1.4

3 years ago

12.0.0

4 years ago

12.1.0

4 years ago

12.0.1

4 years ago

12.1.1

4 years ago

11.7.4

4 years ago

11.7.2

4 years ago

11.7.1

4 years ago

11.7.0

4 years ago

11.6.0

4 years ago

11.5.2

4 years ago

11.3.0

4 years ago

11.2.0

4 years ago

11.1.1

4 years ago

11.1.0

4 years ago

11.0.5

4 years ago

11.0.3

4 years ago

11.0.1

4 years ago

11.0.0

5 years ago

10.0.0

5 years ago

10.0.1

5 years ago

4.2.2

6 years ago

4.2.1

6 years ago

4.2.0

6 years ago

4.1.0

6 years ago

4.0.0

7 years ago

3.0.6

7 years ago

3.0.5

7 years ago

3.0.4

7 years ago

3.0.3

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.1

9 years ago

0.5.0-beta.1

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.0

9 years ago

1.0.0

9 years ago

0.1.0

9 years ago