How to use the mozlog.config function in mozlog

To help you get started, we’ve selected a few mozlog 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 mozilla / fxa / packages / fxa-basket-proxy / lib / logging / index.js View on Github external
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var mozlog = require('mozlog');
var config = require('../config').get('log');

mozlog.config(config);

var root = mozlog('logging');
if (root.isEnabledFor('debug')) {
  root.warn(
    '\t*** CAREFUL! Louder logs (less than INFO)' + ' may include SECRETS! ***'
  );
}

module.exports = mozlog;
github mozilla / fxa-content-server / server / bin / basket-proxy-server.js View on Github external
#!/usr/bin/env node

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


var url = require('url');
var mozlog = require('mozlog');
var request = require('request');

var config = require('../lib/configuration');
mozlog.config(config.get('logging'));

var logger = require('mozlog')('server.basketproxy');

// Side effect - Adds default_fxa and dev_fxa to express.logger formats
var routeLogging = require('../lib/logging/route_logging');

var express = require('express');
var bodyParser = require('body-parser');
var cors = require('cors');

var CORS_ORIGIN = config.get('public_url');
var API_KEY = config.get('basket.api_key');
var API_URL = config.get('basket.api_url');
var API_TIMEOUT = config.get('basket.api_timeout');
var VERIFY_URL = config.get('oauth_url') + '/v1/verify';
github mozilla / fxa-auth-server / lib / senders / log.js View on Github external
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

'use strict'

var mozlog = require('mozlog')

var logConfig = require('../../config').get('log')

mozlog.config(logConfig)

module.exports = mozlog
github mozilla / fxa-content-server / server / bin / csp-violation-server.js View on Github external
#!/usr/bin/env node

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


var fs = require('fs');
var mozlog = require('mozlog');

var config = require('../lib/configuration');
mozlog.config(config.get('logging'));

var logger = require('mozlog')('server.main');

var express = require('express');
var bodyParser = require('body-parser');

function makeApp() {
  var violations = fs.createWriteStream('violations.txt', {flags: 'a'});
  var app = express();
  app.use(bodyParser.json());
  app.get('/index.html', function (req, res) {
    res.json({result: 'ok'});
  });
  app.post('/_/csp-violation', function (req, res) {
    logger.warn('VIOLATION REPORT');
    var data = {
github mozilla / fxa-content-server / server / bin / null-basket-server.js View on Github external
#!/usr/bin/env node

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


var url = require('url');
var mozlog = require('mozlog');

var config = require('../lib/configuration');
mozlog.config(config.get('logging'));

var logger = require('mozlog')('server.nullbasket');

var express = require('express');
var bodyParser = require('body-parser');

var API_KEY = config.get('basket.api_key');
var API_URL = config.get('basket.api_url');


// Error codes are defined in:
// https://github.com/mozilla/basket-client/blob/master/basket/errors.py
/* eslint-disable sorting/sort-object-props */
var BASKET_ERRORS = {
  NETWORK_FAILURE: 1,
  INVALID_EMAIL: 2,
github mozilla / fxa-oauth-console / lib / config.js View on Github external
* Logging
   */
  logging: {
    default: {
      app: 'fxa-oauth-console',
    },
  },
});

var envConfig = path.join(__dirname, '..', 'config', conf.get('env') + '.json');
var files = (envConfig + ',' + process.env.CONFIG_FILES)
  .split(',')
  .filter(fs.existsSync);
conf.loadFile(files);

require('mozlog').config(conf.get('logging'));
process.env.NODE_ENV = conf.get('env');

conf.validate();

module.exports = conf;
github mozilla / fxa-auth-server / lib / log.js View on Github external
function Lug(options) {
  EventEmitter.call(this)
  this.name = options.name || 'fxa-auth-server'
  mozlog.config({
    app: this.name,
    level: options.level,
    stream: options.stderr || process.stderr,
    fmt: options.fmt
  })
  this.logger = mozlog()

  this.stdout = options.stdout || process.stdout

  this.notifier = require('./notifier')(this)
}
util.inherits(Lug, EventEmitter)

mozlog

Logging utility that outputs records for Heka.

MPL-2.0
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis

Popular mozlog functions