1 PACKAGE OE_DEBUG_PUB AUTHID CURRENT_USER AS
2 /* $Header: OEXPDBGS.pls 120.0 2005/06/01 03:05:44 appldev noship $ */
3
4 -- Constants used as tokens for unexpected error Debugs.
5
6 G_PKG_NAME CONSTANT VARCHAR2(15):= 'OE_DEBUG_PUB';
7
8 -- API Debugging table type
9 --
10 -- PL/SQL table of VARCHAR2(2000)
11
12 G_DEBUG_LEN CONSTANT Number := 500;
13 TYPE Debug_tbl_type IS TABLE OF VARCHAR2(500)
14 INDEX BY BINARY_INTEGER;
15
16 G_Debug_Tbl Debug_Tbl_Type;
17
18 -- Global variable holding the Debug count.
19
20 G_Debug_count NUMBER := 0;
21
22 -- Global variable holding the desired debug_level.
23
24 G_Debug_Level NUMBER := FND_PROFILE.VALUE('ONT_DEBUG_LEVEL');
25
26 -- Index used by the Get function to keep track of the last fetched
27 -- Debug.
28
29 G_Debug_index NUMBER := 0;
30 -- Flag to indicate if the debugging is on.
31 -- The call to procedure ADD will add the string to the debug cache
32 G_DEBUG Varchar2(1) := FND_API.G_FALSE;
33 G_DEBUG_MODE VARCHAR2(30) := 'TABLE';
34 -- Table , default mode
35 -- file , write to log file
36 G_DIR Varchar2(255) := nvl(fnd_profile.value
37 ('OE_DEBUG_LOG_DIRECTORY'), '/tmp');
38 G_FILE Varchar2(255) := null;
39 G_FILE_PTR utl_file.file_type;
40 /* Name Set_Debug_mode
41 ** Purpose Sets the debug mode to be FILE or TABLE.
42 ** It will set the debug mode to FILE if specified so else
43 ** the mode is set to TABLE, It reuturns the name of the file if
44 ** the mode desired is FILE else returns null
45 */
46 Function Set_Debug_Mode(P_Mode in varchar2) Return Varchar2;
47 /* Name Initialize
48 ** Purpose Clears the debug cache. Use this procedure to clear out the
49 ** any debugging statments cached in the debug table.
50 */
51 PROCEDURE Initialize;
52 /* Name Debug_On
53 ** Purpose To Turn the debugging on. Use this proceudre to enable debuging
54 ** for the current sesssion. Any subsquent call to the statment add will result
55 ** in the debug statments cached to the debug table
56 */
57 Procedure Debug_ON;
58 /* Name Debug_Off
59 ** Purpose To Turn off the debugging. Use this proceudre to disable debugging
60 ** for the current sesssion. Call to ADD will be ignored. Please note that
61 ** Function does not clear the cache and any debuging information is retained
62 */
63 Procedure Debug_OFF;
64 /* Name IsDebugOn
65 ** Purpose To test if the debugging is enabled.
66 */
67 Function ISDebugOn Return Boolean;
68 /* Name CountDebug
69 ** Purpose To get the number of debugging message cached
70 */
71 FUNCTION CountDebug RETURN NUMBER;
72 /* Name Add
73 ** Purpose To add a debugging message. This message will be placed in
74 ** the table only if the debuggin is turned on.
75 */
76 PROCEDURE Add(debug_msg in Varchar2, debug_level in Number default 5);
77 /* Name GetFirst
78 ** Purpose To Get the First Message. This prcocude will reset the debug index
79 */
80 Procedure GetFirst(Debug_msg out NOCOPY /* file.sql.39 change */ Varchar2);
81 /* Name GetNext
82 ** Purpose To Get the Next Message from the debug cache.
83 ** This Procedure will increment the debug index by one
84 */
85 Procedure GetNext(debug_msg out NOCOPY /* file.sql.39 change */ varchar2);
86 /* Name GetNextBuffer
87 ** Purpose To Get the Next Set of message separted by a new line
88 ** The routine will concatnate the message until reaching the end of the
89 ** mesage cache or the total messages exceed as specified in the p_msg_count
90 ** This Procedure will increment the debug index acordingly
91 */
92 Procedure GetNextBuffer( p_debug_msg in out NOCOPY /* file.sql.39 change */ varchar2);
93 /* Name DumpDebug
94 ** Purpose To disply debug message from the sql prompt.
95 ** This routine will display all the mesages in the cahce using the procedure
96 ** dbms_out.put_line.
97 */
98 PROCEDURE DumpDebug;
99 /* Name ResetIndex
100 ** resest the debug index, setting the index pointer to the beginging of the
101 ** cache
102 */
103 Procedure ResetIndex;
104
105 /* Name SetDebugLevel (p_debug_level in number);
106 ** Set g_debug_level to the desired one
107 */
108 Procedure SetDebugLevel(p_debug_level in number);
109
110 Procedure Start_ONT_Debugger(p_directory IN VARCHAR2,
111 p_filename IN VARCHAR2,
112 p_file_handle IN UTL_FILE.File_Type);
113
114 Procedure Stop_ONT_Debugger;
115
116 END OE_DEBUG_PUB;