1.3.0 • Published 8 months ago

@roarr/browser-log-writer v1.3.0

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
8 months ago

Roarr Browser Log Writer

Travis build status Coveralls NPM version Canonical Code Style Twitter Follow

Roarr log writer for use in a web browser.

Chrome Console

Usage

Import the initialization code anywhere in your codebase, e.g.

import {
  createLogWriter,
} from '@roarr/browser-log-writer';

globalThis.ROARR = globalThis.ROARR ?? {};
globalThis.ROARR.write = createLogWriter();

Alternatively, import @roarr/browser-log-writer/init, which is equivalent to the above code.

import '@roarr/browser-log-writer/init';

If you are using Webpack, then consider using lazy loading, e.g.

import('@roarr/browser-log-writer/init');

Displaying Logs

Logs are produced using console.log. However, by default, no logs are printed.

The simplest way to view all logs is to define ROARR_LOG=true localStorage value, i.e.

Type in console localStorage.setItem('ROARR_LOG', 'true') and refresh the page. Now you should see all the logs.

Filtering Logs

By default all logs are displayed. However, you can narrow down logs using a special constant ROARR_FILTER.

The value of ROARR_FILTER is a Liqe query, e.g.

# Only print logs with `context.logLevel` greater than 10.
localStorage.setItem('ROARR_FILTER', 'context.logLevel:>10')

# Only print logs with `context.namespace` containing "slonik".
localStorage.setItem('ROARR_FILTER', 'context.namespace:slonik')
1.2.0

8 months ago

1.3.0

8 months ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago