webmcp
diff framework/env/trace/request.lua @ 41:0bbfee4d4aed
New functions trace.disable() and trace.is_disabled()
| author | jbe |
|---|---|
| date | Sat Oct 16 17:51:18 2010 +0200 (2010-10-16) |
| parents | 9fdfb27f8e67 |
| children |
line diff
1.1 --- a/framework/env/trace/request.lua Sat Oct 16 17:49:11 2010 +0200 1.2 +++ b/framework/env/trace/request.lua Sat Oct 16 17:51:18 2010 +0200 1.3 @@ -10,28 +10,30 @@ 1.4 --]]-- 1.5 1.6 function trace.request(args) 1.7 - local module = args.module 1.8 - local view = args.view 1.9 - local action = args.action 1.10 - if type(module) ~= "string" then 1.11 - error("No module string passed to trace.request{...}.") 1.12 - end 1.13 - if view and action then 1.14 - error("Both view and action passed to trace.request{...}.") 1.15 - end 1.16 - if not (view or action) then 1.17 - error("Neither view nor action passed to trace.request{...}.") 1.18 + if not trace._disabled then 1.19 + local module = args.module 1.20 + local view = args.view 1.21 + local action = args.action 1.22 + if type(module) ~= "string" then 1.23 + error("No module string passed to trace.request{...}.") 1.24 + end 1.25 + if view and action then 1.26 + error("Both view and action passed to trace.request{...}.") 1.27 + end 1.28 + if not (view or action) then 1.29 + error("Neither view nor action passed to trace.request{...}.") 1.30 + end 1.31 + if view and type(view) ~= "string" then 1.32 + error("No view string passed to trace.request{...}.") 1.33 + end 1.34 + if action and type(action) ~= "string" then 1.35 + error("No action string passed to trace.request{...}.") 1.36 + end 1.37 + trace._new_entry{ 1.38 + type = "request", 1.39 + module = args.module, 1.40 + view = args.view, 1.41 + action = args.action 1.42 + } 1.43 end 1.44 - if view and type(view) ~= "string" then 1.45 - error("No view string passed to trace.request{...}.") 1.46 - end 1.47 - if action and type(action) ~= "string" then 1.48 - error("No action string passed to trace.request{...}.") 1.49 - end 1.50 - trace._new_entry{ 1.51 - type = "request", 1.52 - module = args.module, 1.53 - view = args.view, 1.54 - action = args.action 1.55 - } 1.56 end