Skip to content

OnrampLab/node-universal-loggly

Folders and files

NameName
Last commit message
Last commit date
Nov 19, 2020
Nov 19, 2020
Nov 19, 2020
Jan 9, 2020
Jan 9, 2020
Jan 9, 2020
Jan 13, 2020
Nov 19, 2020
Nov 19, 2020
Nov 26, 2020
Nov 19, 2020
Aug 18, 2021

Repository files navigation

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