From 73b09d4c9c5c2c4c562e4164da76b0f214ebf618 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 5 Oct 2015 14:31:02 +0000 Subject: Modify logfile to get logging info from the config and use common view --- dovecot-controller.lua | 2 +- dovecot-logfile-html.lsp | 9 +-------- dovecot-model.lua | 16 ++++++++++------ 3 files changed, 12 insertions(+), 15 deletions(-) mode change 100644 => 120000 dovecot-logfile-html.lsp diff --git a/dovecot-controller.lua b/dovecot-controller.lua index de36937..8412cb6 100644 --- a/dovecot-controller.lua +++ b/dovecot-controller.lua @@ -19,7 +19,7 @@ function mymodule.expert(self) end function mymodule.logfile(self) - return self.model.get_logfile() + return self.model.get_logfile(self, self.clientdata) end return mymodule diff --git a/dovecot-logfile-html.lsp b/dovecot-logfile-html.lsp deleted file mode 100644 index d718396..0000000 --- a/dovecot-logfile-html.lsp +++ /dev/null @@ -1,8 +0,0 @@ -<% local data, viewlibrary = ... -%> - -<% if viewlibrary and viewlibrary.dispatch_component then - for i,logfile in ipairs(data.value) do - viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename=logfile.path, grep=logfile.grep}) - end -end %> diff --git a/dovecot-logfile-html.lsp b/dovecot-logfile-html.lsp new file mode 120000 index 0000000..ac8854f --- /dev/null +++ b/dovecot-logfile-html.lsp @@ -0,0 +1 @@ +../logfile-html.lsp \ No newline at end of file diff --git a/dovecot-model.lua b/dovecot-model.lua index 74aff69..e2cd0f0 100644 --- a/dovecot-model.lua +++ b/dovecot-model.lua @@ -46,18 +46,22 @@ function mymodule.get_logfile(f) config = config or format.parse_ini_file(fs.read_file(configfile) or "", "") local files = {} if config and config.log_path then - files[#files+1] = {path = config.log_path} + files[#files+1] = {filename = config.log_path} end if config and config.info_log_path then - files[#files+1] = {path = config.info_log_path} + files[#files+1] = {filename = config.info_log_path} end - if config and config.log_path then - files[#files+1] = {path = config.debug_log_path} + if config and config.debug_log_path then + files[#files+1] = {filename = config.debug_log_path} end if 0 == #files then - files[#files+1] = {path = "/var/log/messages", grep = "dovecot"} + if config and config.syslog_facility then + files[#files+1] = {facility = config.syslog_facility, grep = "dovecot"} + else + files[#files+1] = {facility = "mail", grep = "dovecot"} + end end - return cfe({ value=files, label="DoveCot Log Files" }) + return cfe({ type="structure", value=files, label="DoveCot Log Files" }) end return mymodule -- cgit v1.2.3