webmcp
view framework/env/trace/request.lua @ 484:66086fa01d6e
Code cleanup; Pass moonbridge_io.poll to main handlers
| author | jbe | 
|---|---|
| date | Sun Jun 11 22:29:20 2017 +0200 (2017-06-11) | 
| parents | 0bbfee4d4aed | 
| children | 
 line source
     1 --[[--
     2 trace.request{
     3   module = module,
     4   view   = view,
     5   action = action
     6 }
     8 This function is called automatically to log which view or action has been requested by the web browser.
    10 --]]--
    12 function trace.request(args)
    13   if not trace._disabled then
    14     local module       = args.module
    15     local view         = args.view
    16     local action       = args.action
    17     if type(module) ~= "string" then
    18       error("No module string passed to trace.request{...}.")
    19     end
    20     if view and action then
    21       error("Both view and action passed to trace.request{...}.")
    22     end
    23     if not (view or action) then
    24       error("Neither view nor action passed to trace.request{...}.")
    25     end
    26     if view and type(view) ~= "string" then
    27       error("No view string passed to trace.request{...}.")
    28     end
    29     if action and type(action) ~= "string" then
    30       error("No action string passed to trace.request{...}.")
    31     end
    32     trace._new_entry{
    33       type = "request",
    34       module       = args.module,
    35       view         = args.view,
    36       action       = args.action
    37     }
    38   end
    39 end
