diff options
author | Robin Krahl <me@robin-krahl.de> | 2015-06-27 21:12:01 +0200 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2015-06-27 21:12:01 +0200 |
commit | d513bc565782965d66c6307bfefe21dc3fd36c1a (patch) | |
tree | 7a7c153166fe49ea43d710c3166b251b686efc19 /mediawiki.lrdevplugin/MediaWikiUtils.lua | |
parent | 8ff19746de44b1b8139cb6137738cf080ac8563a (diff) | |
download | LrMediaWiki-d513bc565782965d66c6307bfefe21dc3fd36c1a.tar.gz LrMediaWiki-d513bc565782965d66c6307bfefe21dc3fd36c1a.tar.bz2 |
Add a configuration section to the plugin information dialog.
Customize the plugin information dialog and add a configuration section. In this
section, the user may enable or disable logging.
- create MediaWikiPluginInfoProvider to customize the plugin information dialog
- add MediaWikiPluginInfoProvider to Info to activate it
- enable or disable logging in MediaWikiUtils according to the configuration
- update the localization
See #31.
Diffstat (limited to 'mediawiki.lrdevplugin/MediaWikiUtils.lua')
-rw-r--r-- | mediawiki.lrdevplugin/MediaWikiUtils.lua | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/mediawiki.lrdevplugin/MediaWikiUtils.lua b/mediawiki.lrdevplugin/MediaWikiUtils.lua index 7d1dd8d..6727e3b 100644 --- a/mediawiki.lrdevplugin/MediaWikiUtils.lua +++ b/mediawiki.lrdevplugin/MediaWikiUtils.lua @@ -15,16 +15,13 @@ local LrLogger = import 'LrLogger'
local Info = require 'Info'
-local myLogger = LrLogger('LrMediaWikiLogger')
-
--- LOGGING
--- If enabled, the log file will appear in your "My Documents" folder. Warning:
--- LrMediaWiki will log all requests sent to MediaWiki, including your password!
--- If you share a log file, make sure you removed your password.
--- To enable logging, uncomment the following line:
--- myLogger:enable("logfile")
local MediaWikiUtils = {}
+local myLogger = LrLogger('LrMediaWikiLogger')
+local prefs = import 'LrPrefs'.prefsForPlugin()
+if prefs.logging then
+ myLogger:enable('logfile')
+end
-- Allows formatting of strings like "${test} eins zwei drei ${test2}"
-- Based on a solution by http://lua-users.org/wiki/RiciLake shown here:
@@ -45,6 +42,14 @@ MediaWikiUtils.getVersionString = function() return str
end
+MediaWikiUtils.setLogging = function(logging)
+ if logging then
+ myLogger:enable('logfile')
+ else
+ myLogger:disable()
+ end
+end
+
MediaWikiUtils.trace = function(message)
myLogger:trace(message)
end
|