npm.io
0.3.1 • Published 8 months ago

universal-loggly

Licence
MIT
Version
0.3.1
Deps
1
Size
39 kB
Vulns
0
Weekly
0

universal-loggly

feature

  • send log to Loggly

how to install

  • yarn add universal-loggly

include example

  • vi /your-project/app.js
  // for library
  import { LogglyClient } from 'universal-loggly';

  // you can custom myself helper
  export function factoryLogglyClient() {
    return new LogglyClient(`<loggly host>`, 'token', 'secret')
  }

sample code

import { factoryLogglyClient } from 'universal-loggly-helper';

const logger = factoryLogglyClient();
const message = 'test message';
const redirectUrl = 'https://duckduckgo.com/';
const promise = logger.info(message, {
  extend_content: true,
});

promise.then(function(data) {
  // success
})
.catch(function(error) {
  console.error(`[universal-loggly]: ${error}`);
})
.finally(function() {
  window.location.href = redirectUrl;
});

plan of future

  • storage cookie
  • send hook

Keywords