diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-12-30 15:06:08 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-12-30 15:06:08 +0000 |
commit | 574e7b03768daa9f1c038f4e6742937f385282ef (patch) | |
tree | 0d023e8c1fb91517ec3d1f639e753bd548b1ab8c /app/acf_www-controller.lua | |
parent | 6c9f16f82e911e1b2c05918f9b8ce0d78fb3aa55 (diff) | |
download | acf-core-574e7b03768daa9f1c038f4e6742937f385282ef.tar.bz2 acf-core-574e7b03768daa9f1c038f4e6742937f385282ef.tar.xz |
Added logfile config setting to acf.conf
Diffstat (limited to 'app/acf_www-controller.lua')
-rw-r--r-- | app/acf_www-controller.lua | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua index 9c63d74..1977491 100644 --- a/app/acf_www-controller.lua +++ b/app/acf_www-controller.lua @@ -219,7 +219,9 @@ end mvc = {} mvc.on_load = function (self, parent) -- open the log file - self.conf.logfile = io.open ("/var/log/acf.log", "a+") + if self.conf.logfile then + self.conf.loghandle = io.open (self.conf.logfile, "a+") + end --logevent("acf_www-controller mvc.on_load") @@ -289,7 +291,9 @@ mvc.on_unload = function (self) end -- Close the logfile --logevent("acf_www-controller mvc.on_unload") - self.conf.logfile:close() + if self.conf.loghandle then + self.conf.loghandle:close() + end end -- Overload the MVC's exception handler with our own to handle redirection @@ -542,7 +546,11 @@ parse_redir_string = function( str ) return prefix, controller, action end --- FIXME - need to think more about this.. logevent = function ( message ) - conf.logfile:write (string.format("%s: %s\n", os.date(), message or "")) + if conf.loghandle then + conf.loghandle:write (string.format("%s: %s\n", os.date(), message or "")) + else + -- call to parent's handler + __index.logevent(message) + end end |