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


Python Logging.warning方法代码示例

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


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

示例1: renderErrorPage

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	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,代码行数:36,代码来源:http.py

示例2: createCommandLineDescription

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
 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,代码行数:9,代码来源:scsendorigin.py

示例3: render_GET

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	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,代码行数:10,代码来源:event.py

示例4: render_POST

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	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,代码行数:11,代码来源:station.py

示例5: render_GET

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	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,代码行数:12,代码来源:station.py

示例6: render_POST

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	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,代码行数:12,代码来源:http.py

示例7: render_POST

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	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,代码行数:12,代码来源:dataselect.py

示例8: render_POST

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	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,代码行数:12,代码来源:http.py

示例9: render_GET

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	def render_GET(self, req):
		# Parse and validate POST parameters
		ro = _DataSelectRequestOptions(req.args)
		ro.userName = self.__user and self.__user.get('mail')
		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:aemanov,项目名称:seiscomp3,代码行数:13,代码来源:dataselect.py

示例10: resumeProducing

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	def resumeProducing(self):
		rec = None
		data = ""
		while len(data) < self.bufSize:
			try:
				rec = self.rsInput.next()
				if rec: data += rec.raw().str()
				else: break
			except Exception, e:
				Logging.warning("%s" % str(e))
				break
开发者ID:Fran89,项目名称:seiscomp3,代码行数:13,代码来源:dataselect.py

示例11: render_GET

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	def render_GET(self, req):
		# No archive no service
		if not os.path.isdir(self._sdsPath):
			msg = "SDS archive not found: %s" % self._sdsPath
			return HTTP.renderErrorPage(request, http.SERVICE_UNAVAILABLE, msg)

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

示例12: renderErrorPage

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	def renderErrorPage(request, code, msg):
		html = """\
<html>
	<head><title>%i - %s</title></head>
	<body>
		<h1>%s</h1>
		<p>%s</p>
	</body>
</html>"""

		request.setHeader("Content-Type", "text/html")
		request.setResponseCode(code)

		codeStr = http.RESPONSES[code]
		Logging.warning("Responding with error: %i (%s)" % (code, codeStr))
		return html % (code, codeStr, codeStr, msg)
开发者ID:salichon,项目名称:SC3_VM_seattle,代码行数:18,代码来源:http.py

示例13: resumeProducing

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	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,代码行数:34,代码来源:dataselect.py

示例14: resumeProducing

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	def resumeProducing(self):
		rec = None

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

		if not self.initialized:
			self.initialized = True
			# read first record to test if any data exists at all

			if not rec:
				msg = "No waveform data found"
				self.req.write(HTTP.renderErrorPage(self.req, http.NOT_FOUND, msg))
				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()
			self.req.finish()
			return

		self.req.write(rec.raw().str())
开发者ID:salichon,项目名称:SC3_VM_seattle,代码行数:29,代码来源:utils.py

示例15: _addStream

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import warning [as 别名]
	def _addStream(self, ro, streams, toks, lastFileName):
		start, end = Time(), Time()
		if start.fromString("%s.%s" % (toks[4], toks[5]), "%Y.%j") and \
		   end.fromString(lastFileName[-8:] + "23:59:59", "%Y.%j%T"):
			# match time
			if ro.time.start > end or \
			   (ro.time.end and ro.time.end < start):
				return

			# limit time to requested time
			if ro.time.start > start:
				start = ro.time.start
			if ro.time.end and ro.time.end < end:
				end = ro.time.end

			streams.append((toks[1], toks[2], start, end))
		else:
			Logging.warning("invalid stream information: %s%s.%s" % (
			                toks[0], toks[1], toks[2]))
开发者ID:salichon,项目名称:SC3_VM_seattle,代码行数:21,代码来源:wsavailability.py


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