From cd3659a6ddf522cd52cc18716ceacc46ca3d92c7 Mon Sep 17 00:00:00 2001 From: David Levanon Date: Wed, 7 Dec 2016 14:19:13 +0200 Subject: [PATCH] allow custom log file name --- cli.js | 1 + index.js | 2 +- logger/index.js | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cli.js b/cli.js index b5f2311..dc38563 100755 --- a/cli.js +++ b/cli.js @@ -14,6 +14,7 @@ if (argv.help) { '--help Display this help message and exit', '--port The port to listen on (default: 4567)', '--path The path to use for the LevelDB store (in-memory by default)', + '--logFileName The file name of the log', '--ssl Enable SSL for the web server (default: false)', '--createTableMs Amount of time tables stay in CREATING state (default: 500)', '--deleteTableMs Amount of time tables stay in DELETING state (default: 500)', diff --git a/index.js b/index.js index b3c33a1..debcadf 100644 --- a/index.js +++ b/index.js @@ -29,7 +29,7 @@ function dynalite(options) { options = options || {} var server, stores = {}, requestHandler = httpHandler.bind(null, stores, options) - logger = dynaliteLogger.createLogger("dynalite_log", __dirname, options) + logger = dynaliteLogger.createLogger(__dirname, options) if (options.memoryStats) { setInterval(function() { diff --git a/logger/index.js b/logger/index.js index 95ea84b..433f96e 100644 --- a/logger/index.js +++ b/logger/index.js @@ -11,7 +11,7 @@ exports.getInstance = getInstance var instance; // Public -function createLogger (name, defaultPath, opts) { +function createLogger (defaultPath, opts) { if (!opts.verbose) { instance = { info:function() {}, @@ -25,7 +25,7 @@ function createLogger (name, defaultPath, opts) { var dataDirectory = opts.path ? opts.path : defaultPath // If we're not in-memory use the same directory for logs. var logsDirectory = getValidLogDirectory(dataDirectory); - var fullPath = path.join(logsDirectory, getLogFileName(name)); + var fullPath = path.join(logsDirectory, getLogFileName(opts.logFileName || "dynalite_log")); instance = new (winston.Logger)({ transports: [