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