DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PROC_LOGGING

Source


1 package body pay_proc_logging as
2 /* $Header: pycolog.pkb 120.1.12010000.1 2008/07/27 22:22:28 appldev ship $ */
3 
4 /*
5    PY_ENTRY
6 
7    Standard log entry point call for batch processing
8 */
9 procedure PY_ENTRY(p_print_string in varchar2)
10 is
11 l_print varchar2(4000);
12 begin
13 --
14    if (instr(pay_proc_environment_pkg.logging_category,
15               PY_ROUTING) <>  0
16        or pay_proc_environment_pkg.process_env_type = FALSE
17        ) then
18 --
19     l_print := '';
20     for i in 1..pay_proc_environment_pkg.logging_level loop
21       l_print := l_print||'  ';
22     end loop;
23     l_print := l_print||'In  { '||p_print_string;
24     PY_LOG_WRT(l_print);
25 --
26     pay_proc_environment_pkg.logging_level :=
27             pay_proc_environment_pkg.logging_level + 1;
28 --
29    end if;
30 --
31 end PY_ENTRY;
32 --
33 /*
34    PY_EXIT
35 
36    Standard log exit point call for batch processing
37 */
38 
39 procedure PY_EXIT(p_print_string in varchar2)
40 is
41 l_print varchar2(4000);
42 begin
43 --
44    if (instr(pay_proc_environment_pkg.logging_category,
45               PY_ROUTING) <> 0
46        or pay_proc_environment_pkg.process_env_type = FALSE) then
47 --
48     pay_proc_environment_pkg.logging_level :=
49             pay_proc_environment_pkg.logging_level - 1;
50 --
51     l_print := '';
52     for i in 1..pay_proc_environment_pkg.logging_level loop
53       l_print := l_print||'  ';
54     end loop;
55     l_print := l_print||'Out } '||p_print_string;
56     PY_LOG_WRT(l_print);
57 --
58    end if;
59 --
60 end PY_EXIT;
61 --
62 /*
63    PY_LOG
64 
65    General logging call, used for the PY_GENERAL category.
66 */
67 procedure PY_LOG(p_print_string in varchar2)
68 is
69 begin
70 --
71    if (instr(pay_proc_environment_pkg.logging_category,
72               PY_GENERAL) <> 0
73        or pay_proc_environment_pkg.process_env_type = FALSE) then
74 --
75     PY_LOG_WRT(p_print_string);
76 --
77    end if;
78 --
79 end PY_LOG;
80 --
81 /*
82    PY_LOG_WRT
83 
84    Writes the print string directly to the log file.
85 */
86 procedure PY_LOG_WRT(p_print_string in varchar2)
87 is
88 text_size number;
89 begin
90 --
91    if (pay_proc_environment_pkg.process_env_type = FALSE) then
92 --
93       hr_utility.trace(p_print_string);
94 --
95    elsif (instr(pay_proc_environment_pkg.logging_category,
96              PY_INTRSQL) <> 0) then
97 --
98       text_size := length(p_print_string||'
99 ');
100 --
101       dbms_lob.write(g_log_file,
102                      text_size,
103                      g_log_position,
104                      p_print_string||'
105 '
106                     );
107 --
108       g_log_position := g_log_position + text_size;
109 --
110    end if;
111 --
112 end PY_LOG_WRT;
113 --
114 /*
115    PY_LOG_TXT
116 
117    Writes the print string directly to the log file
118    for a specific logging category..
119 */
120 procedure PY_LOG_TXT(p_logging_type in varchar2,
121                      p_print_string in varchar2)
122 is
123 begin
124 --
125    if (instr(pay_proc_environment_pkg.logging_category,
126              p_logging_type) <> 0
127         or p_logging_type = PY_ALLCATS
128         or pay_proc_environment_pkg.process_env_type = FALSE) then
129 
130 --
131     PY_LOG_WRT(p_print_string);
132 --
133    end if;
134 --
135 end PY_LOG_TXT;
136 --
137 /*
138    init_logging
139 
140    Setup the process logging
141 */
142 procedure init_logging
143 is
144 begin
145    dbms_lob.createtemporary(g_log_file, TRUE);
146 end init_logging;
147 
148 /*
149    deinit_logging
150 
151    Shutdown the process logging
152 */
153 procedure deinit_logging
154 is
155 begin
156    dbms_lob.freetemporary(g_log_file);
157    g_log_file := null;
158    g_log_position := 1;
159 end deinit_logging;
160 --
161 /*
162    init_logging
163 
164    Setup the formula logging
165 */
166 procedure init_form_logging
167 is
168 begin
169    dbms_lob.createtemporary(g_flog_file, TRUE);
170 end init_form_logging;
171 
172 /*
173    deinit_logging
174 
175    Shutdown the formula logging
176 */
177 procedure deinit_form_logging
178 is
179 begin
180    dbms_lob.freetemporary(g_flog_file);
181    g_flog_file := null;
182    g_flog_position := 1;
183 end deinit_form_logging;
184 
185 /*
186    PY_LOG_FORM
187 
188    Writes the print string directly to the formula log
189 */
190 function PY_LOG_FORMULA(p_print_string in varchar2) return number
191 is
192 text_size number;
193 begin
194 --
195    if (instr(pay_proc_environment_pkg.logging_category,
196              PY_FORMULA) <> 0) then
197 --
198       text_size := length(p_print_string||' ');
199 --
200       dbms_lob.write(g_flog_file,
201                      text_size,
202                      g_flog_position,
203                      p_print_string||' '
204                     );
205 --
206       g_flog_position := g_flog_position + text_size;
207 --
208    end if;
209 --
210 return 1;
211 end PY_LOG_FORMULA;
212 --
213 begin
214 g_log_file := null;
215 g_log_position := 1;
216 g_flog_file := null;
217 g_flog_position := 1;
218 
219 end pay_proc_logging;