Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: third_party/buildbot_8_4p1/buildbot/status/web/status_json.py

Issue 392223002: Added logging to the status_json.py (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Added diff to the README.chromium Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/buildbot_8_4p1/README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of Buildbot. Buildbot is free software: you can 1 # This file is part of Buildbot. Buildbot is free software: you can
2 # redistribute it and/or modify it under the terms of the GNU General Public 2 # redistribute it and/or modify it under the terms of the GNU General Public
3 # License as published by the Free Software Foundation, version 2. 3 # License as published by the Free Software Foundation, version 2.
4 # 4 #
5 # This program is distributed in the hope that it will be useful, but WITHOUT 5 # This program is distributed in the hope that it will be useful, but WITHOUT
6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
8 # details. 8 # details.
9 # 9 #
10 # You should have received a copy of the GNU General Public License along with 10 # You should have received a copy of the GNU General Public License along with
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 def RecurseFix(res, level): 155 def RecurseFix(res, level):
156 res.level = level + 1 156 res.level = level + 1
157 for c in res.children.itervalues(): 157 for c in res.children.itervalues():
158 RecurseFix(c, res.level) 158 RecurseFix(c, res.level)
159 159
160 RecurseFix(res, self.level) 160 RecurseFix(res, self.level)
161 resource.Resource.putChild(self, name, res) 161 resource.Resource.putChild(self, name, res)
162 162
163 def render_GET(self, request): 163 def render_GET(self, request):
164 """Renders a HTTP GET at the http request level.""" 164 """Renders a HTTP GET at the http request level."""
165 userAgent = request.requestHeaders.getRawHeaders(
166 'user-agent', ['unknown'])[0]
167 print 'Received request for %s from %s, id: %s' % (
agable 2014/07/16 16:39:20 Printing is the saddest kind of logging. Please lo
Sergiy Byelozyorov 2014/07/17 08:29:12 Done.
168 request.uri, userAgent, id(request))
165 d = defer.maybeDeferred(lambda : self.content(request)) 169 d = defer.maybeDeferred(lambda : self.content(request))
166 def handle(data): 170 def handle(data):
167 if isinstance(data, unicode): 171 if isinstance(data, unicode):
168 data = data.encode("utf-8") 172 data = data.encode("utf-8")
169 request.setHeader("Access-Control-Allow-Origin", "*") 173 request.setHeader("Access-Control-Allow-Origin", "*")
170 if RequestArgToBool(request, 'as_text', False): 174 if RequestArgToBool(request, 'as_text', False):
171 request.setHeader("content-type", 'text/plain') 175 request.setHeader("content-type", 'text/plain')
172 else: 176 else:
173 request.setHeader("content-type", self.contentType) 177 request.setHeader("content-type", self.contentType)
174 request.setHeader("content-disposition", 178 request.setHeader("content-disposition",
175 "attachment; filename=\"%s.json\"" % request.pat h) 179 "attachment; filename=\"%s.json\"" % request.pat h)
176 # Make sure we get fresh pages. 180 # Make sure we get fresh pages.
177 if self.cache_seconds: 181 if self.cache_seconds:
178 now = datetime.datetime.utcnow() 182 now = datetime.datetime.utcnow()
179 expires = now + datetime.timedelta(seconds=self.cache_seconds) 183 expires = now + datetime.timedelta(seconds=self.cache_seconds)
180 request.setHeader("Expires", 184 request.setHeader("Expires",
181 expires.strftime("%a, %d %b %Y %H:%M:%S GMT")) 185 expires.strftime("%a, %d %b %Y %H:%M:%S GMT"))
182 request.setHeader("Pragma", "no-cache") 186 request.setHeader("Pragma", "no-cache")
183 return data 187 return data
184 d.addCallback(handle) 188 d.addCallback(handle)
185 def ok(data): 189 def ok(data):
190 print 'Finished processing request with id: %s' % id(request)
186 request.write(data) 191 request.write(data)
187 request.finish() 192 request.finish()
188 def fail(f): 193 def fail(f):
189 request.processingFailed(f) 194 request.processingFailed(f)
190 return None # processingFailed will log this for us 195 return None # processingFailed will log this for us
191 d.addCallbacks(ok, fail) 196 d.addCallbacks(ok, fail)
192 return server.NOT_DONE_YET 197 return server.NOT_DONE_YET
193 198
194 @defer.deferredGenerator 199 @defer.deferredGenerator
195 def content(self, request): 200 def content(self, request):
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 if not builder: 764 if not builder:
760 return 765 return
761 EXAMPLES = EXAMPLES.replace('<A_BUILDER>', builder.getName()) 766 EXAMPLES = EXAMPLES.replace('<A_BUILDER>', builder.getName())
762 build = builder.getBuild(-1) 767 build = builder.getBuild(-1)
763 if build: 768 if build:
764 EXAMPLES = EXAMPLES.replace('<A_BUILD>', str(build.getNumber())) 769 EXAMPLES = EXAMPLES.replace('<A_BUILD>', str(build.getNumber()))
765 if builder.slavenames: 770 if builder.slavenames:
766 EXAMPLES = EXAMPLES.replace('<A_SLAVE>', builder.slavenames[0]) 771 EXAMPLES = EXAMPLES.replace('<A_SLAVE>', builder.slavenames[0])
767 772
768 # vim: set ts=4 sts=4 sw=4 et: 773 # vim: set ts=4 sts=4 sw=4 et:
OLDNEW
« no previous file with comments | « third_party/buildbot_8_4p1/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698