0.1.6 • Published 6 years ago

seq-browser v0.1.6

Weekly downloads
16
License
MIT
Repository
github
Last release
6 years ago

seq-browser

Log to Seq from the browser

Build Status Coverage Status

Usage

Include the Javascript file under dist/seq-browser.js. The project uses WebPack so it supports CommonJS/AMD/RequireJS.

If none of these are detected then it will be available under window.seq. A seq-browser instance is pre-instantiated for you as a singleton. This allows you share the server settings and context throughout your application.

Specify your Seq server url

seq.serverUrl = "https://seq.logs";

If your Seq server requires an API key you can set this up here as well

seq.apiKey = "12345-api-key-54321";

Logging

Any time you log with seq-browser it will automatically be sent to Seq.

seq.information('{User} logged in to {Service} at {Date}', {
  User: 'Test User',
  Service: 'My Awesome Service',
  Date: new Date()
});

The following log levels are available

log.verbose();
log.debug();
log.information();
log.warning();
log.error();
log.fatal();

Context

To add properties that apply to all logs sent to Seq you can manipulate the context property of Logger.

log.context.UserId = 99999;
log.context.UserEmail = 'tester@test.com';
0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago