当前位置: 首页>>代码示例>>Python>>正文


Python seiscomp3.Logging类代码示例

本文整理汇总了Python中seiscomp3.Logging的典型用法代码示例。如果您正苦于以下问题:Python Logging类的具体用法?Python Logging怎么用?Python Logging使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Logging类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: resumeProducing

	def resumeProducing(self):
		rec = None

		try: rec = self.rsInput.next()
		except Exception, e: Logging.warning("%s" % str(e))

		if self.written == 0:
			# read first record to test if any data exists at all
			if not rec:
				msg = "no waveform data found"
				data = HTTP.renderErrorPage(self.req, http.NO_CONTENT, msg, self.ro)
				if data:
					self.req.write(data)
				self.req.unregisterProducer()
				self.req.finish()
				return

			self.req.setHeader('Content-Type', 'application/vnd.fdsn.mseed')
			self.req.setHeader('Content-Disposition', "attachment; " \
			                   "filename=%s" % self.fileName)

		if not rec:
			self.req.unregisterProducer()
			Logging.debug("%s: returned %i bytes of mseed data" % (
			               self.ro.service, self.written))
			utils.accessLog(self.req, self.ro, http.OK, self.written, None)
			self.req.finish()
			return

		data = rec.raw().str()
		self.req.write(data)
		self.written += len(data)
开发者ID:duperray,项目名称:seiscomp3,代码行数:32,代码来源:dataselect.py

示例2: renderErrorPage

	def renderErrorPage(request, code, msg, ro=None):
		resp = """\
Error %i: %s

%s

Usage details are available from %s

Request:
%s

Request Submitted:
%s

Service Version:
%s
"""

		# rewrite response code if requested and no data was found
		if ro is not None and code == http.NO_CONTENT:
			code = ro.noData

		request.setHeader('Content-Type', 'text/plain')
		request.setResponseCode(code)

		reference = "%s/" % (request.path.rpartition('/')[0])

		codeStr = http.RESPONSES[code]
		Logging.warning("responding with error: %i (%s)" % (code, codeStr))
		date = Core.Time.GMT().toString("%FT%T.%f")
		response = resp % (code, codeStr, msg, reference, request.uri, date,
		                   VERSION)
		utils.accessLog(request, ro, code, len(response), msg)
		return response
开发者ID:smellyfis,项目名称:seiscomp3,代码行数:34,代码来源:http.py

示例3: _processRequest

	def _processRequest(self, req, ro, dbq, exp):
		if req._disconnected:
			return False

		DataModel.PublicObject.SetRegistrationEnabled(False)

		# query event(s)
		ep = DataModel.EventParameters()
		if ro.eventIDs:
			for eID in ro.eventIDs:
				event = dbq.getEventByPublicID(eID)
				event = DataModel.Event.Cast(event)
				if event:
					ep.add(event)
		else:
			self._findEvents(ep, ro, dbq)

		if ep.eventCount() == 0:
			msg = "no matching events found"
			utils.writeTS(req,
			              HTTP.renderErrorPage(req, http.NO_CONTENT, msg, ro))
			return False

		Logging.debug("events found: %i" % ep.eventCount())

		if ro.format == 'csv' or not exp:
			req.setHeader('Content-Type', 'text/plain')
		else:
			req.setHeader('Content-Type', 'application/xml')

		if exp:
			return self._processRequestExp(req, ro, dbq, exp, ep)

		return self._processRequestText(req, ro, dbq, ep)
开发者ID:smellyfis,项目名称:seiscomp3,代码行数:34,代码来源:event.py

示例4: run

	def run(self):
		retn = False
		try:
			for user in self._authBlacklist:
				self._userdb.blacklistUser(user)

			site = self._site()

			if not site:
				return False

			# start listen for incoming request
			self.__tcpPort = reactor.listenTCP(self._port,
			                                   site,
	 		                                   self._connections,
			                                   self._listenAddress)

			# setup signal handler
			self.__sighup = False
			signal.signal(signal.SIGHUP, self._sighupHandler)
		        task.LoopingCall(self._reloadTask).start(60, False)

			# start processing
			Logging.info("start listening")
			log.addObserver(logSC3)

			reactor.run()
			retn = True
		except Exception, e:
			Logging.error(str(e))
开发者ID:marcelobianchi,项目名称:seiscomp3,代码行数:30,代码来源:fdsnws.py

示例5: createCommandLineDescription

 def createCommandLineDescription(self):
     try:
         self.commandline().addGroup("Parameters")
         self.commandline().addStringOption("Parameters", "coord", "lat,lon,dep of origin")
         self.commandline().addStringOption("Parameters", "time", "time of origin")
     except:
         Logging.warning("caught unexpected error %s" % sys.exc_info())
开发者ID:Fran89,项目名称:seiscomp3,代码行数:7,代码来源:scsendorigin.py

示例6: onCancel

def onCancel(failure, req):
	if failure:
		Logging.error("%s %s" % (failure.getErrorMessage(),
		              traceback.format_tb(failure.getTracebackObject())))
	else:
		Logging.error("request canceled")
	req.cancel()
开发者ID:Fran89,项目名称:seiscomp3,代码行数:7,代码来源:utils.py

示例7: render_GET

	def render_GET(self, req):
		# Parse and validate GET parameters
		ro = _EventRequestOptions(req.args)
		try:
			ro.parse()
		except ValueError, e:
			Logging.warning(str(e))
			return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
开发者ID:salichon,项目名称:SC3_VM_seattle,代码行数:8,代码来源:event.py

示例8: onRequestServed

def onRequestServed(success, req):
	if req._disconnected:
		Logging.debug("Request aborted")
		return

	Logging.debug("Request %s" % (
	              "successfully served" if success else "failed"))
	reactor.callFromThread(req.finish)
开发者ID:salichon,项目名称:SC3_VM_seattle,代码行数:8,代码来源:utils.py

示例9: getResourceFor

	def getResourceFor(self, request):
		Logging.debug("request (%s): %s" % (request.getClientIP(),
		              request.uri))
		request.setHeader('Server', "SeisComP3-FDSNWS/%s" % VERSION)
		request.setHeader('Access-Control-Allow-Origin', '*')
		request.setHeader('Access-Control-Allow-Headers', 'Authorization')
		request.setHeader('Access-Control-Expose-Headers', 'WWW-Authenticate')
		return server.Site.getResourceFor(self, request)
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:8,代码来源:http.py

示例10: _processRequest

	def _processRequest(self, req, ro, dbq, exp):
		if req._disconnected:
			return False

		DataModel.PublicObject.SetRegistrationEnabled(False)

		# query event(s)
		ep = DataModel.EventParameters()
		if ro.eventIDs:
			for eID in ro.eventIDs:
				obj = dbq.getEventByPublicID(eID)
				e = DataModel.Event.Cast(obj)
				if not e:
					continue

				if self._eventTypeWhitelist or self._eventTypeBlacklist:
					eType = None
					try: eType = DataModel.EEventTypeNames_name(e.type())
					except ValueException: pass
					if self._eventTypeWhitelist and \
					   not eType in self._eventTypeWhitelist: continue
					if self._eventTypeBlacklist and \
					   eType in self._eventTypeBlacklist: continue

				if self._evaluationMode is not None:
					obj = dbq.getObject(DataModel.Origin.TypeInfo(),
					                    e.preferredOriginID())
					o = DataModel.Origin.Cast(obj)
					try:
						if o is None or \
						   o.evaluationMode() != self._evaluationMode:
							continue
					except ValueException:
						continue

				ep.add(e)
		else:
			self._findEvents(ep, ro, dbq)

		if ep.eventCount() == 0:
			msg = "no matching events found"
			data = HTTP.renderErrorPage(req, http.NO_CONTENT, msg, ro)
			if data:
				utils.writeTS(req, data)
			return True

		Logging.debug("events found: %i" % ep.eventCount())

		if ro.format == 'csv' or not exp:
			req.setHeader('Content-Type', 'text/plain')
		else:
			req.setHeader('Content-Type', 'application/xml')

		if exp:
			return self._processRequestExp(req, ro, dbq, exp, ep)

		return self._processRequestText(req, ro, dbq, ep)
开发者ID:gomes310,项目名称:seiscomp3,代码行数:57,代码来源:event.py

示例11: render_POST

	def render_POST(self, req):
		# Parse and validate POST parameters
		ro = _StationRequestOptions()
		try:
			ro.parsePOST(req.content)
			ro.parse()
		except ValueError, e:
			Logging.warning(str(e))
			return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:9,代码来源:station.py

示例12: render_GET

	def render_GET(self, req):
		# Parse and validate GET parameters
		ro = _StationRequestOptions(req.args)
		try:
			ro.parse()
			# the GET operation supports exactly one stream filter
			ro.streams.append(ro)
		except ValueError, e:
			Logging.warning(str(e))
			return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:10,代码来源:station.py

示例13: render_POST

	def render_POST(self, request):
		request.setHeader('Content-Type', 'text/plain')

		try:
			verified = self.__gpg.decrypt(request.content.getvalue())

		except Exception, e:
			msg = "invalid token"
			Logging.warning("%s: %s" % (msg, str(e)))
			return HTTP.renderErrorPage(request, http.BAD_REQUEST, msg, None)
开发者ID:marcelobianchi,项目名称:seiscomp3,代码行数:10,代码来源:http.py

示例14: render_POST

	def render_POST(self, request):
		request.setHeader('Content-Type', 'text/plain')

		try:
			verified = self.__gpg.decrypt(request.content.getvalue())

		except OSError, e:
			msg = "gpg decrypt error"
			Logging.warning("%s: %s" % (msg, str(e)))
			return HTTP.renderErrorPage(request, http.INTERNAL_SERVER_ERROR, msg, None)
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:10,代码来源:http.py

示例15: render_POST

	def render_POST(self, req):
		# Parse and validate POST parameters
		ro = _DataSelectRequestOptions()
		ro.userName = self.__user and self.__user.get('mail')
		try:
			ro.parsePOST(req.content)
			ro.parse()
		except ValueError, e:
			Logging.warning(str(e))
			return HTTP.renderErrorPage(req, http.BAD_REQUEST, str(e), ro)
开发者ID:aemanov,项目名称:seiscomp3,代码行数:10,代码来源:dataselect.py


注:本文中的seiscomp3.Logging类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。