0.1.6 • Published 6 years ago
seq-browser v0.1.6
seq-browser
Log to Seq from the browser
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';