|
|
@ -1,17 +1,17 @@
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
var path = require('path');
|
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
var nconf = require('nconf');
|
|
|
|
var fs = require('fs');
|
|
|
|
var fs = require('fs');
|
|
|
|
var winston = require('winston');
|
|
|
|
var winston = require('winston');
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function (Meta) {
|
|
|
|
module.exports = function (Meta) {
|
|
|
|
|
|
|
|
|
|
|
|
Meta.logs = {
|
|
|
|
Meta.logs = {
|
|
|
|
path: path.join('logs', path.sep, 'output.log')
|
|
|
|
path: path.join(nconf.get('base_dir'), 'logs', 'output.log')
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Meta.logs.get = function (callback) {
|
|
|
|
Meta.logs.get = function (callback) {
|
|
|
|
fs.readFile(this.path, {
|
|
|
|
fs.readFile(Meta.logs.path, {
|
|
|
|
encoding: 'utf-8'
|
|
|
|
encoding: 'utf-8'
|
|
|
|
}, function (err, logs) {
|
|
|
|
}, function (err, logs) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
@ -23,6 +23,7 @@ module.exports = function (Meta) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Meta.logs.clear = function (callback) {
|
|
|
|
Meta.logs.clear = function (callback) {
|
|
|
|
fs.truncate(this.path, 0, callback);
|
|
|
|
fs.truncate(Meta.logs.path, 0, callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|