Files
NodeBB/src/meta/logs.js
psychobunny 0c8e0ca46f linted /meta
2015-02-25 19:28:43 -05:00

28 lines
540 B
JavaScript

'use strict';
var path = require('path'),
fs = require('fs'),
winston = require('winston');
module.exports = function(Meta) {
Meta.logs = {
path: path.join('logs', path.sep, 'output.log')
};
Meta.logs.get = function(callback) {
fs.readFile(this.path, {
encoding: 'utf-8'
}, function(err, logs) {
if (err) {
winston.error('[meta/logs] Could not retrieve logs: ' + err.message);
}
callback(undefined, logs || '');
});
};
Meta.logs.clear = function(callback) {
fs.truncate(this.path, 0, callback);
};
};