webmcp

diff framework/env/trace/request.lua @ 0:9fdfb27f8e67

Version 1.0.0
author jbe/bsw
date Sun Oct 25 12:00:00 2009 +0100 (2009-10-25)
parents
children 0bbfee4d4aed
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/framework/env/trace/request.lua	Sun Oct 25 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +--[[--
     1.5 +trace.request{
     1.6 +  module = module,
     1.7 +  view   = view,
     1.8 +  action = action
     1.9 +}
    1.10 +
    1.11 +This function is called automatically to log which view or action has been requested by the web browser.
    1.12 +
    1.13 +--]]--
    1.14 +
    1.15 +function trace.request(args)
    1.16 +  local module       = args.module
    1.17 +  local view         = args.view
    1.18 +  local action       = args.action
    1.19 +  if type(module) ~= "string" then
    1.20 +    error("No module string passed to trace.request{...}.")
    1.21 +  end
    1.22 +  if view and action then
    1.23 +    error("Both view and action passed to trace.request{...}.")
    1.24 +  end
    1.25 +  if not (view or action) then
    1.26 +    error("Neither view nor action passed to trace.request{...}.")
    1.27 +  end
    1.28 +  if view and type(view) ~= "string" then
    1.29 +    error("No view string passed to trace.request{...}.")
    1.30 +  end
    1.31 +  if action and type(action) ~= "string" then
    1.32 +    error("No action string passed to trace.request{...}.")
    1.33 +  end
    1.34 +  trace._new_entry{
    1.35 +    type = "request",
    1.36 +    module       = args.module,
    1.37 +    view         = args.view,
    1.38 +    action       = args.action
    1.39 +  }
    1.40 +end

Impressum / About Us