How to use logdna - 3 common examples

To help you get started, we’ve selected a few logdna examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ernestii / vuelibs.org / server / parser.js View on Github external
import Mongoose from "mongoose";
import Component from "./models/component";
import axios from "axios";
import { markdown } from "markdown";
import Octokit from "@octokit/rest";
import Logger from 'logdna';

const DELAY = 2000;

const AV_URL = "https://raw.githubusercontent.com/vuejs/awesome-vue/master/README.md";

let logger = console;

if (process.env.ENV === 'prod' && process.env.LOGDNA_KEY) {
    logger = Logger.setupDefaultLogger(process.env.LOGDNA_KEY, {
        app: 'org.vuelib.parser'
    });
}

if (!process.env.OCTOKIT_KEY) {
    logger.log('OCTOKIT_KEY is not defined.');
    process.exit(1);
}

async function connectMongo() {
    try {
        await Mongoose.connect(process.env.MONGODB_URL || 'mongodb://mongo:27017/vuelibs');
        logger.log('Connected to mongo');
    } catch (err) {
        logger.log('Could not connect to mongo');
    }
github machinomy / machinomy / packages / logger / src / Logger.ts View on Github external
let levels = new Levels(namespace)
    this._fatal = levels.fatal
    this._error = levels.error
    this._warn = levels.warn
    this._info = levels.info
    this._debug = levels.debug
    this._trace = levels.trace
    this.namespace = namespace
    if (logDNAKey && logDNAKey.length > 0) {
      if (!logDNAOptions) {
        logDNAOptions = {}
      }
      if (!logDNAOptions.hasOwnProperty('hostname')) {
        logDNAOptions = { ...logDNAOptions, hostname: '' }
      }
      this.loggerDNA = LogDNA.setupDefaultLogger(logDNAKey, logDNAOptions)
    }
  }
github bluzi / travis-buddy / utils / logger.js View on Github external
},
  ],
});

let logzIoLogger;

if (process.env.logzIoAccessToken) {
  logzIoLogger = logzIo.createLogger({
    token: process.env.logzIoAccessToken,
    type: 'api',
  });
}

let logdnaLogger;
if (process.env.logdnaApiKey) {
  logdnaLogger = logdna.createLogger(process.env.logdnaApiKey, {
    env,
    hostname: os.hostname(),
    ip: ip.address(),
  });
}

function setLevel(level) {
  switch (level) {
    case 'all':
      logLevel = 1;
      break;

    case 'warnings':
      logLevel = 2;
      break;

logdna

LogDNA's Node.js Logging Module.

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis