logging.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. -- Licensed to the public under the Apache License 2.0.
  2. local m = Map("radicale2", translate("Radicale 2.x"),
  3. translate("A lightweight CalDAV/CardDAV server"))
  4. local s = m:section(NamedSection, "logging", "section", translate("Logging"))
  5. s.addremove = true
  6. s.anonymous = false
  7. local logging_file = nil
  8. logging_file = s:option(FileUpload, "config", translate("Logging File"), translate("Log configuration file (no file means default procd which ends up in syslog"))
  9. logging_file.rmempty = true
  10. logging_file.default = ""
  11. o = s:option(Button, "remove_conf", translate("Remove configuration for logging"),
  12. translate("This permanently deletes configuration for logging"))
  13. o.inputstyle = "remove"
  14. function o.write(self, section)
  15. if logging_file:cfgvalue(section) and fs.access(logging_file:cfgvalue(section)) then fs.unlink(loggin_file:cfgvalue(section)) end
  16. self.map:del(section, "config")
  17. luci.http.redirect(luci.dispatcher.build_url("admin", "services", "radicale2", "logging"))
  18. end
  19. o = s:option(Flag, "debug", translate("Debug"), translate("Send debug information to logs"))
  20. o.rmempty = true
  21. o.default = o.disabled
  22. o = s:option(Flag, "full_environment", translate("Dump Environment"), translate("Include full environment in logs"))
  23. o.rmempty = true
  24. o.default = o.disabled
  25. o = s:option(Flag, "mask_passwords", translate("Mask Passwords"), translate("Redact passwords in logs"))
  26. o.rmempty = true
  27. o.default = o.enabled
  28. -- TODO: Allow configuration logging file from this page
  29. return m