Skip to content

AshKyd/loggly-light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Loggly Light 🌳

A lightweight (~0.5 kb minified) Loggly logger for the browser.

Use it to report errors, track stats, UGC, whatever it is you do.

Basic example

Install in your project with npm i loggly-light. Then:

var logger = new Loggly({ customerToken: "abc123" });
logger.log("my loggly tag", {hello: 'world'});

Promise-based interface

You can use the promise-based interface to verify the log made it/catch errors. This is useful if you want to send the log before an action takes place (eg. page navigation).

logger.log("my loggly tag", {hello: 'world'})
  .then(() => {})
  .catch(() => {});

Global Loggly token

You can also store your customer token on window._loggly_customer_token for a config-free init.

var logger = new Loggly();
logger.log("my loggly tag", {hello: 'world'});

This is useful if you're creating lots of small projects but want to keep your Loggly customer token centralised.

Required polyfills

This library uses ES5 syntax so doesn't need to be transpiled, but if you're using it in older browsers you may need to polyfill Promise and fetch.

About

A lightweight loggly logger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published