Skip to content
Snippets Groups Projects
Commit 28a690fa authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

local logs should be stored in a directory, make logging stuff create directories as needed

parent 77286282
No related branches found
No related tags found
No related merge requests found
*~
\#*\#
.\#*
node_modules
/node_modules
/var
......@@ -7,7 +7,9 @@
* exports.configure(app);
*/
const substitution = require('./substitute.js');
const
substitution = require('./substitute.js'),
path = require('path');
var g_config = {
};
......@@ -56,7 +58,7 @@ const g_configs = {
port: '10002',
scheme: 'http',
use_minified_resources: false,
log_path: './',
log_path: path.join(__dirname, "..", "var", "logs"),
database: { driver: "json" }
}
};
......
const
winston = require("winston"),
configuration = require("./configuration"),
path = require('path');
path = require('path'),
fs = require('fs');
// go through the configuration and determine log location
// for now we only log to one place
......@@ -10,9 +11,21 @@ path = require('path');
var log_path = configuration.get('log_path');
var LOGGERS = [];
// simple inline function for creation of dirs
function mkdir_p(p) {
if (!path.existsSync(p)) {
mkdir_p(path.dirname(p));
console.log("mkdir", p);
fs.mkdirSync(p, "0755");
}
}
function setupLogger(category) {
if (!log_path)
return console.log("no log path! Not logging!");
else
mkdir_p(log_path);
// don't create the logger if it already exists
if (LOGGERS[category])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment