Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: logger seperator should be one EOL (#972)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored and dead-horse committed Jun 26, 2016
1 parent 97895bd commit 38148b2
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions common/logger.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
'use strict';

var debug = require('debug')('cnpmjs.org:logger');
var formater = require('error-formater');
var Logger = require('mini-logger');
var utility = require('utility');
var util = require('util');
var config = require('../config');
var mail = require('./mail');
const debug = require('debug')('cnpmjs.org:logger');
const formater = require('error-formater');
const Logger = require('mini-logger');
const utility = require('utility');
const util = require('util');
const os = require('os');
const config = require('../config');
const mail = require('./mail');

var isTEST = process.env.NODE_ENV === 'test';
var categories = ['sync_info', 'sync_error'];
const isTEST = process.env.NODE_ENV === 'test';
const categories = ['sync_info', 'sync_error'];

var logger = module.exports = Logger({
const logger = module.exports = Logger({
categories: categories,
dir: config.logdir,
duration: '1d',
format: '[{category}.]YYYY-MM-DD[.log]',
stdout: config.debug && !isTEST,
errorFormater: errorFormater
errorFormater: errorFormater,
seperator: os.EOL,
});

var to = [];
const to = [];
for (var user in config.admins) {
to.push(config.admins[user]);
}

function errorFormater(err) {
var msg = formater.both(err);
const msg = formater.both(err);
mail.error(to, msg.json.name, msg.text);
return msg.text;
}

logger.syncInfo = function () {
var args = [].slice.call(arguments);
const args = [].slice.call(arguments);
if (typeof args[0] === 'string') {
args[0] = util.format('[%s][%s] ', utility.logDate(), process.pid) + args[0];
}
Expand All @@ -43,7 +45,7 @@ logger.syncInfo = function () {
};

logger.syncError =function () {
var args = [].slice.call(arguments);
const args = [].slice.call(arguments);
if (typeof args[0] === 'string') {
args[0] = util.format('[%s][%s] ', utility.logDate(), process.pid) + args[0];
}
Expand Down

0 comments on commit 38148b2

Please sign in to comment.