Centralize the logs path in the Helper
This commit is contained in:
parent
d6f2def825
commit
f65ffdff1e
@ -5,6 +5,7 @@ var Helper = {
|
|||||||
expandHome: expandHome,
|
expandHome: expandHome,
|
||||||
getConfig: getConfig,
|
getConfig: getConfig,
|
||||||
getUserConfigPath: getUserConfigPath,
|
getUserConfigPath: getUserConfigPath,
|
||||||
|
getUserLogsPath: getUserLogsPath,
|
||||||
setHome: setHome,
|
setHome: setHome,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -20,6 +21,10 @@ function getUserConfigPath(name) {
|
|||||||
return path.join(this.USERS_PATH, name + ".json");
|
return path.join(this.USERS_PATH, name + ".json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUserLogsPath(name, network) {
|
||||||
|
return path.join(this.HOME, "logs", name, network);
|
||||||
|
}
|
||||||
|
|
||||||
function getConfig() {
|
function getConfig() {
|
||||||
return require(this.CONFIG_PATH);
|
return require(this.CONFIG_PATH);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ var Helper = require("./helper");
|
|||||||
|
|
||||||
module.exports.write = function(user, network, chan, msg) {
|
module.exports.write = function(user, network, chan, msg) {
|
||||||
try {
|
try {
|
||||||
var path = require("path").join(Helper.HOME, "logs", user, network);
|
var path = Helper.getUserLogsPath(user, network);
|
||||||
mkdirp.sync(path);
|
mkdirp.sync(path);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error("Unabled to create logs directory", e);
|
log.error("Unabled to create logs directory", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user