/[eiffelstudio]/branches/eth/eve/Src/Eiffel/interface/graphical/tools/autodebug/log/es_adb_logger.e
ViewVC logotype

Contents of /branches/eth/eve/Src/Eiffel/interface/graphical/tools/autodebug/log/es_adb_logger.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 95332 - (show annotations)
Fri Jun 27 12:57:49 2014 UTC (5 years, 3 months ago) by maxpei
File size: 4214 byte(s)
Fixed a few bugs in AutoFix and AutoDebug.
1 note
2 description: "Summary description for {ES_ADB_LOGGER}."
3 author: ""
4 date: "$Date$"
5 revision: "$Revision$"
6
7 deferred class
8 ES_ADB_LOGGER
9
10 inherit
11 ES_ADB_ACTIONS
12
13 ES_ADB_SHARED_INFO_CENTER
14
15 feature -- Access
16
17 log_file: PLAIN_TEXT_FILE
18 -- Log file.
19
20 feature -- Status report
21
22 is_logging: BOOLEAN
23 -- Is current logging?
24 do
25 Result := log_file /= Void and then log_file.is_open_append
26 end
27
28 feature -- Setter
29
30 start_logging
31 -- Initialize current with `a_dir'.
32 local
33 l_root_dir: PATH
34 do
35 l_root_dir := info_center.config.working_directory.root_dir
36 create log_file.make_with_path (l_root_dir.extended (log_file_name))
37 if not log_file.exists then
38 log_file.open_write
39 log_file.close
40 end
41 log_file.open_append
42 end
43
44 stop_logging
45 -- Close `log_file'.
46 do
47 if is_logging then
48 log_file.flush
49 log_file.close
50 end
51 log_file := Void
52 ensure
53 not is_logging
54 end
55
56 clear_log
57 -- Clear `log_file' from last logging.
58 do
59 stop_logging
60 log_file.wipe_out
61 end
62
63 feature -- Logging
64
65 ensured_log (a_msg: STRING)
66 -- Ensure `a_msg' is logged.
67 -- Open the log file if not already, and restore the file state after logging.
68 require
69 a_msg /= Void
70 local
71 l_was_logging: BOOLEAN
72 do
73 l_was_logging := is_logging
74 if not l_was_logging then
75 start_logging
76 end
77 log (a_msg)
78 if not l_was_logging then
79 stop_logging
80 end
81 end
82
83 log (a_msg: STRING)
84 -- Log `a_msg'.
85 require
86 a_msg /= Void
87 do
88 if is_logging then
89 log_file.put_string (a_msg)
90 log_file.flush
91 end
92 end
93
94 log_line (a_msg: STRING)
95 -- Log `a_msg' and start a new line.
96 require
97 a_msg /= Void
98 do
99 if is_logging then
100 log_file.put_string (a_msg)
101 log_file.put_character ('%N')
102 log_file.flush
103 end
104 end
105
106 feature -- ADB Action
107
108 on_project_loaded
109 -- <Precursor>
110 do
111 end
112
113 on_project_unloaded
114 -- <Precursor>
115 do
116 end
117
118 on_compile_start
119 -- <Precursor>
120 do
121 end
122
123 on_compile_stop
124 -- <Precursor>
125 do
126 end
127
128 on_debugging_start
129 -- <Precursor>
130 do
131 start_logging
132 end
133
134 on_debugging_stop
135 -- <Precursor>
136 do
137 stop_logging
138 end
139
140 on_testing_start
141 -- <Precursor>
142 do
143 end
144
145 on_test_case_generated (a_test: ES_ADB_TEST)
146 -- <Precursor>
147 do
148 end
149
150 on_testing_stop
151 -- <Precursor>
152 do
153 end
154
155 on_fixing_start (a_fault: ES_ADB_FAULT)
156 -- <Precursor>
157 do
158 end
159
160 on_fixing_stop
161 -- <Precursor>
162 do
163 end
164
165 on_continuation_debugging_start
166 -- <Precursor>
167 do
168 start_logging
169 end
170
171 on_continuation_debugging_stop
172 -- <Precursor>
173 do
174 stop_logging
175 end
176
177 on_valid_fix_found (a_fix: ES_ADB_FIX)
178 -- <Precursor>
179 do
180 end
181
182 on_fix_applied (a_fix: ES_ADB_FIX)
183 -- <Precursor>
184 do
185 end
186
187 on_output (a_line: STRING)
188 -- <Precursor>
189 do
190 end
191
192 feature{NONE} -- Implementation
193
194 log_file_name: STRING
195 -- Name of the log file.
196 deferred
197 end
198
199 note
200 copyright: "Copyright (c) 1984-2014, Eiffel Software"
201 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
202 licensing_options: "http://www.eiffel.com/licensing"
203 copying: "[
204 This file is part of Eiffel Software's Eiffel Development Environment.
205
206 Eiffel Software's Eiffel Development Environment is free
207 software; you can redistribute it and/or modify it under
208 the terms of the GNU General Public License as published
209 by the Free Software Foundation, version 2 of the License
210 (available at the URL listed under "license" above).
211
212 Eiffel Software's Eiffel Development Environment is
213 distributed in the hope that it will be useful, but
214 WITHOUT ANY WARRANTY; without even the implied warranty
215 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
216 See the GNU General Public License for more details.
217
218 You should have received a copy of the GNU General Public
219 License along with Eiffel Software's Eiffel Development
220 Environment; if not, write to the Free Software Foundation,
221 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
222 ]"
223 source: "[
224 Eiffel Software
225 5949 Hollister Ave., Goleta, CA 93117 USA
226 Telephone 805-685-1006, Fax 805-685-6869
227 Website http://www.eiffel.com
228 Customer support http://support.eiffel.com
229 ]"
230 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23