How to use the log-driver.logger function in log-driver

To help you get started, we’ve selected a few log-driver 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 badges / shielded / lib / svg2png.js View on Github external
module.exports = function svgToPng(sourceFileName, destFileName, scale, cb) {
    if (typeof scale === "function") {
        cb = scale;
        scale = 1.0;
    }

    var args = [phantomjsCmd, converterFileName, sourceFileName, destFileName, scale];
    require('log-driver').logger.debug(args);
    execFile(process.execPath, args, function (err, stdout, stderr) {
        if (err) {
            cb(err);
        } else if (stdout.length > 0) { // PhantomJS always outputs to stdout.
            cb(new Error(stdout.toString().trim()));
        } else if (stderr.length > 0) { // But hey something else might get to stderr.
            cb(new Error(stderr.toString().trim()));
        } else {
            cb(null);
        }
    });
};
github badges / shielded / lib / shield.js View on Github external
// image is from: https://github.com/olivierlacan/shields 
var svg2png = require('./svg2png');
var fs = require('fs');
var logger = require('log-driver').logger;

var getUniqueId = function(vendorText, statusText, color, scale){
  return new Buffer(JSON.stringify({vendor:vendorText,
                                    status:statusText,
                                    color:color,
                                    scale:scale}))
                .toString('base64');
};

var shield = function(options, cb){
  if (!options.vendorText || !options.statusText){
    return cb("missing required field.");
  }
  if (options.loglevel || options.loglevel === false){
    logger = require('log-driver').logger = require('log-driver')({level : options.loglevel });
  }
github badges / shielded / lib / shield.js View on Github external
var shield = function(options, cb){
  if (!options.vendorText || !options.statusText){
    return cb("missing required field.");
  }
  if (options.loglevel || options.loglevel === false){
    logger = require('log-driver').logger = require('log-driver')({level : options.loglevel });
  }
  var vendorText = options.vendorText;
  var statusText = options.statusText;
  var color = options.color || 'lightgray';
  var scale = options.scale || 1;
  var tempdir = options.tempdir || '/tmp';
  var filename = options.filename || getUniqueId(vendorText, 
                                                 statusText, 
                                                 color, 
                                                 scale) + '.png';
  if (['green', 'yellow',
        'yellowgreen', 'red',
        'lightgray' ].indexOf(color) === -1){
    return cb("invalid background color: " + color);
  }
github cainus / percolator / lib / Percolator.js View on Github external
var index = require('../index');
var JsonStatus = require('json-status');
var onJsonHelper = index.onJsonHelper;
var fetchHelper = index.FetchHelper;
var AuthenticateHelper = index.AuthenticateHelper;
var BasicAuthenticateHelper = index.BasicAuthenticateHelper;
var ObjectHelper = index.ObjectHelper;
var _ = require('underscore');
var fs = require('fs');
var Server = require('oneone');
var hyperjsonBrowser = require('hyperjson-browser');
var connect = require('connect');
var nodePath = require('path');
var urlgreyConnect = require('urlgrey-connect');
var hyperjsonConnect = require('hyperjson-connect');
var logger = require('log-driver').logger;


var Percolator = function(options){
  if (!(this instanceof Percolator)) {
    return new Percolator(options);
  }
  var that = this;
  this.connectApp = connect();
  options = options || {};
  this.options = options;
  this.options.port = this.options.port || 3000;
  this.options.ip = this.options.ip || '0.0.0.0';
  if (this.options.autoLink !== false){
    this.options.autoLink = true;
  }
  var autoLink = this.options.autoLink;

log-driver

log-driver is a simple logging framework for logging to stdout

ISC
Latest version published 7 years ago

Package Health Score

62 / 100
Full package analysis