blob: 829d8a168ae09883e4eec164bd761634616d7c53 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 #include <trace.h>
MG Mud User88f12472016-06-24 23:31:02 +02003
Zesstrad59c3892019-11-28 20:53:39 +01004 int trace(int traceflags)
MG Mud User88f12472016-06-24 23:31:02 +02005
Zesstra715ec202025-07-09 22:18:31 +02006DESCRIPTION
7 Sets the trace flags and returns the old trace flags. When
8 tracing is on, a lot of information is printed during
9 execution and too much output can crash your connection or
10 even the whole driver.
MG Mud User88f12472016-06-24 23:31:02 +020011
Zesstra715ec202025-07-09 22:18:31 +020012 Tracing is done on a per-connection basis: each interactive(!)
13 user may specifiy their own tracelevel and -prefix. Each gets the
14 traceoutput for just the code executed during the evaluation
15 of the commands he entered.
MG Mud User88f12472016-06-24 23:31:02 +020016
Zesstra715ec202025-07-09 22:18:31 +020017 The trace bits are:
MG Mud User88f12472016-06-24 23:31:02 +020018
Zesstra715ec202025-07-09 22:18:31 +020019 TRACE_NOTHING ( 0): stop tracing.
MG Mud User88f12472016-06-24 23:31:02 +020020
Zesstra715ec202025-07-09 22:18:31 +020021 TRACE_CALL ( 1): trace all calls to lfuns.
22 TRACE_CALL_OTHER ( 2): trace call_others()s.
23 TRACE_RETURN ( 4): trace function returns.
24 TRACE_ARGS ( 8): print function arguments and results.
25 TRACE_EXEC ( 16): trace all executed instructions.
26 TRACE_HEART_BEAT ( 32): trace heartbeat code.
27 TRACE_APPLY ( 64): trace driver applies.
28 TRACE_OBJNAME (128): print the object names.
MG Mud User88f12472016-06-24 23:31:02 +020029
Zesstra715ec202025-07-09 22:18:31 +020030 TRACE_EXEC and TRACE_HEART_BEAT should be avoided as they cause
31 massive output! TRACE_OBJNAME should be avoided when you know
32 what you trace.
MG Mud User88f12472016-06-24 23:31:02 +020033
Zesstra715ec202025-07-09 22:18:31 +020034 The master-lfun valid_trace() is called with ("trace", traceflags)
35 as argument to verify the use of this efun.
36
37
38EXAMPLES
MG Mud User88f12472016-06-24 23:31:02 +020039 object obj;
40 string prefix;
Zesstra715ec202025-07-09 22:18:31 +020041 obj = find_player("wessex");
42 prefix = object_name(obj);
43 prefix = prefix[1..]; /* cut off the leading "/" */
MG Mud User88f12472016-06-24 23:31:02 +020044 traceprefix(prefix);
Zesstra715ec202025-07-09 22:18:31 +020045 /* From here on, only code in the object "std/player#69"
46 * will be traced.
47 */
MG Mud User88f12472016-06-24 23:31:02 +020048 trace(TRACE_CALL|TRACE_CALL_OTHER|TRACE_RETURN|TRACE_ARGS);
49 ...
50 trace(TRACE_NOTHING);
51
Zesstra715ec202025-07-09 22:18:31 +020052HISTORY
53 LDMud 3.2.9 passes the <traceflags> argument to the valid_trace()
54 apply as well.
MG Mud User88f12472016-06-24 23:31:02 +020055
Zesstra715ec202025-07-09 22:18:31 +020056SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020057 traceprefix(E)