changeset 283:50dcadcf5070 release-2.0

Plugin logger: various error, closes #505, closes #507
author David Demelier <markand@malikania.fr>
date Tue, 01 Nov 2016 13:39:39 +0100
parents c234b8db1816
children d37069bcbbab
files plugins/logger/logger.js plugins/logger/logger.md
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/logger/logger.js	Tue Nov 01 13:10:20 2016 +0100
+++ b/plugins/logger/logger.js	Tue Nov 01 13:39:39 2016 +0100
@@ -83,7 +83,7 @@
 
 function write(fmt, args)
 {
-	var path = Util.format(Plugin.config["path"], args);
+	var path = Util.format(Plugin.config["file"], args);
 	var directory = File.dirname(path);
 
 	/* Try to create the directory */
@@ -95,15 +95,22 @@
 	Logger.debug("opening: " + path);
 
 	var str = Util.format(formats[fmt], args);
-	var file = new File(path, "wa");
+	var file = new File(path, "a");
 
 	file.write(str + "\n");
 }
 
 function onLoad()
 {
-	if (Plugin.config["path"] === undefined)
-		throw new Error("Missing 'path' option");
+	if (Plugin.config["file"] === undefined)
+		throw new Error("Missing 'file' option");
+
+    loadFormats();
+}
+
+function onReload()
+{
+    loadFormats();
 }
 
 function onChannelMode(server, origin, channel, mode, arg)
--- a/plugins/logger/logger.md	Tue Nov 01 13:10:20 2016 +0100
+++ b/plugins/logger/logger.md	Tue Nov 01 13:39:39 2016 +0100
@@ -37,17 +37,17 @@
 The following options are available under the `[plugin.logger]` section:
 
   - **file**: (string) the path to the file where to store logs,
-  - **cmode**: (string) format for channel mode change,
-  - **cnotice**: (string) format for channel notices,
-  - **join**: (string) format when someone joins a channel,
-  - **kick**: (string) format when someone has been kicked,
-  - **me**: (string) format for emote actions,
-  - **message**: (string) format for channel messages,
-  - **mode**: (string) format for user mode change,
-  - **notice**: (string) format on private notices,
-  - **part**: (string) format when someone leaves a channel,
-  - **query**: (string) format on private messages,
-  - **topic**: (string) format when a topic is changed.
+  - **format-cmode**: (string) format for channel mode change,
+  - **format-cnotice**: (string) format for channel notices,
+  - **format-join**: (string) format when someone joins a channel,
+  - **format-kick**: (string) format when someone has been kicked,
+  - **format-me**: (string) format for emote actions,
+  - **format-message**: (string) format for channel messages,
+  - **format-mode**: (string) format for user mode change,
+  - **format-notice**: (string) format on private notices,
+  - **format-part**: (string) format when someone leaves a channel,
+  - **format-query**: (string) format on private messages,
+  - **format-topic**: (string) format when a topic is changed.
 
 ### Keywords supported