本文整理汇总了Python中seiscomp3.Logging.info方法的典型用法代码示例。如果您正苦于以下问题:Python Logging.info方法的具体用法?Python Logging.info怎么用?Python Logging.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类seiscomp3.Logging
的用法示例。
在下文中一共展示了Logging.info方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _loadInventory
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def _loadInventory(self):
Logging.notice("loading inventory")
dbr = DataModel.DatabaseReader(self.database())
self._inv = DataModel.Inventory()
# Load networks and stations
staCount = 0
for i in xrange(dbr.loadNetworks(self._inv)):
staCount += dbr.load(self._inv.network(i))
Logging.debug("loaded %i stations from %i networks" % (
staCount, self._inv.networkCount()))
# Load sensors, skip calibrations (not needed by StationXML exporter)
Logging.debug("loaded %i sensors" % dbr.loadSensors(self._inv))
# Load datalogger and its decimations, skip calibrations (not needed by
# StationXML exporter)
deciCount = 0
for i in xrange(dbr.loadDataloggers(self._inv)):
deciCount += dbr.loadDecimations(self._inv.datalogger(i))
Logging.debug("loaded %i decimations from %i dataloggers" % (
deciCount, self._inv.dataloggerCount()))
# Load responses
resPAZCount = dbr.loadResponsePAZs(self._inv)
resFIRCount = dbr.loadResponseFIRs(self._inv)
resPolCount = dbr.loadResponsePolynomials(self._inv)
resCount = resPAZCount + resFIRCount + resPolCount
Logging.debug("loaded %i responses (PAZ: %i, FIR: %i, Poly: %i)" % (
resCount, resPAZCount, resFIRCount, resPolCount))
Logging.info("inventory loaded")
示例2: run
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
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))
示例3: __init__
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def __init__(self, config, name, group):
mediatorAddress = config.getString("connection.server")
dbDriverName = config.getString("database.type")
dbAddress = config.getString("database.parameters")
connection = Communication.Connection.Create(mediatorAddress, name, group)
if connection is None:
Logging.error("Cannot connect to Mediator")
raise ConnectionError, "connection could not be established"
else:
Logging.info("Connection has been established")
dbDriver = IO.DatabaseInterface.Create(dbDriverName)
if dbDriver is None:
Logging.error("Cannot find database driver " + dbDriverName)
raise DatabaseError, "driver not found"
if not dbDriver.connect(dbAddress):
Logging.error("Cannot connect to database at " + dbAddress)
raise DatabaseError, "connection could not be established"
self.__connection = connection
# This reference to dbDriver is essential, since dbQuery becomes
# invalid when dbDriver is deleted
self.__dbDriver = dbDriver
self.dbQuery = DatabaseQuery(dbDriver)
示例4: logSC3
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def logSC3(entry):
try:
isError = entry['isError']
msg = entry['message']
if isError:
for l in msg:
Logging.error("[reactor] %s" % l)
else:
for l in msg:
Logging.info("[reactor] %s" % l)
except:
pass
示例5: run
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def run(self):
rules = self.rules
iv = Client.Inventory.Instance().inventory()
if not rules:
return False
if not iv:
return False
Logging.debug("Loaded %d networks" % iv.networkCount())
if self.outputFile is None:
DataModel.Notifier.Enable()
self.setInterpretNotifierEnabled(True)
for net in self._loop(iv.network, iv.networkCount()):
(ncode, nstart, nend) = self._collect(net)
key = rules.findKey(ncode, nstart, nend)
if not key:
continue
att = rules.getNetworkAttributes(key)
self._modifyInventory("network", net, att)
Logging.info("%s %s" % (ncode, att))
for sta in self._loop(net.station, net.stationCount()):
(scode, sstart, send) = self._collect(sta)
att = rules.getStationAttributes(key, ncode, scode, None, None, sstart, send)
self._modifyInventory("station", sta, att)
if att:
Logging.info(" %s %s" % (scode, att))
for loc in self._loop(sta.sensorLocation, sta.sensorLocationCount()):
(lcode, lstart, lend) = self._collect(loc)
att = rules.getStationAttributes(key, ncode, scode, lcode, None, lstart, lend)
self._modifyInventory("location", loc, att)
if att:
Logging.info(" %s %s" % (lcode, att))
for cha in self._loop(loc.stream, loc.streamCount()):
(ccode, cstart, cend) = self._collect(cha)
att = rules.getStationAttributes(key, ncode, scode, lcode, ccode, cstart, cend)
self._modifyInventory("channel", cha, att)
if att:
Logging.info(" %s %s" % (ccode, att))
for sensor in self._loop(iv.sensor, iv.sensorCount()):
att = rules.getInstrumentsAttributes(sensor.name(), "Se")
self._modifyInventory("sensor", sensor, att)
for datalogger in self._loop(iv.datalogger, iv.dataloggerCount()):
att = rules.getInstrumentsAttributes(datalogger.name(), "Dl")
self._modifyInventory("datalogger", datalogger, att)
return True
示例6: _reloadTask
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def _reloadTask(self):
if not self.__sighup:
return
self.__sighup = False
Logging.info("reloading inventory")
self.reloadInventory()
site = self._site()
if site:
self.__tcpPort.factory = site
Logging.info("reload successful")
else:
Logging.info("reload failed")
self._userdb.dump()
示例7: send_notifiers
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def send_notifiers(self, group):
Nsize = DataModel.Notifier.Size()
if Nsize > 0:
Logging.info("trying to apply %d change%s" % (Nsize, "s" if Nsize != 1 else ""))
else:
Logging.info("no changes to apply")
return 0
Nmsg = DataModel.Notifier.GetMessage(True)
it = Nmsg.iter()
msg = DataModel.NotifierMessage()
maxmsg = 100
sent = 0
mcount = 0
try:
try:
while it.get():
msg.attach(DataModel.Notifier_Cast(it.get()))
mcount += 1
if msg and mcount == maxmsg:
sent += mcount
Logging.debug("sending message (%5.1f %%)" % (sent / float(Nsize) * 100.0))
self.send(group, msg)
msg.clear()
mcount = 0
self.sync()
it.next()
except:
pass
finally:
if msg.size():
Logging.debug("sending message (%5.1f %%)" % 100.0)
self.send(group, msg)
msg.clear()
self.sync()
Logging.info("done")
return mcount
示例8: run
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
#.........这里部分代码省略.........
return False
# access logger if requested
if self._accessLogFile:
self._accessLog = Log(self._accessLogFile)
# load inventory needed by DataSelect and Station service
if self._serveDataSelect or self._serveStation:
self._loadInventory()
DataModel.PublicObject.SetRegistrationEnabled(False)
shareDir = os.path.join(Environment.Instance().shareDir(), 'fdsnws')
# Overwrite/set mime type of *.wadl and *.xml documents. Instead of
# using the official types defined in /etc/mime.types 'application/xml'
# is used as enforced by the FDSNWS spec.
static.File.contentTypes['.wadl'] = 'application/xml'
static.File.contentTypes['.xml'] = 'application/xml'
# create resource tree /fdsnws/...
root = ListingResource()
fileName = os.path.join(shareDir, 'favicon.ico')
fileRes = static.File(fileName, 'image/x-icon')
fileRes.childNotFound = NoResource()
fileRes.isLeaf = True
root.putChild('favicon.ico', fileRes)
prefix = ListingResource()
root.putChild('fdsnws', prefix)
# right now service version is shared by all services
serviceVersion = ServiceVersion()
# dataselect
if self._serveDataSelect:
dataselect = ListingResource()
prefix.putChild('dataselect', dataselect)
dataselect1 = DirectoryResource(os.path.join(shareDir, 'dataselect.html'))
dataselect.putChild('1', dataselect1)
dataselect1.putChild('query', FDSNDataSelect())
msg = 'authorization for restricted time series data required'
authSession = self._getAuthSessionWrapper(FDSNDataSelectRealm(), msg)
dataselect1.putChild('queryauth', authSession)
dataselect1.putChild('version', serviceVersion)
fileRes = static.File(os.path.join(shareDir, 'dataselect.wadl'))
fileRes.childNotFound = NoResource()
dataselect1.putChild('application.wadl', fileRes)
# event
if self._serveEvent:
event = ListingResource()
prefix.putChild('event', event)
event1 = DirectoryResource(os.path.join(shareDir, 'event.html'))
event.putChild('1', event1)
event1.putChild('query', FDSNEvent(self._hideAuthor,
self._evaluationMode,
self._eventTypeWhitelist,
self._eventTypeBlacklist))
fileRes = static.File(os.path.join(shareDir, 'catalogs.xml'))
fileRes.childNotFound = NoResource()
event1.putChild('catalogs', fileRes)
fileRes = static.File(os.path.join(shareDir, 'contributors.xml'))
fileRes.childNotFound = NoResource()
event1.putChild('contributors', fileRes)
event1.putChild('version', serviceVersion)
fileRes = static.File(os.path.join(shareDir, 'event.wadl'))
fileRes.childNotFound = NoResource()
event1.putChild('application.wadl', fileRes)
# station
if self._serveStation:
station = ListingResource()
prefix.putChild('station', station)
station1 = DirectoryResource(os.path.join(shareDir, 'station.html'))
station.putChild('1', station1)
station1.putChild('query', FDSNStation(self._inv, self._allowRestricted, self._queryObjects))
station1.putChild('version', serviceVersion)
fileRes = static.File(os.path.join(shareDir, 'station.wadl'))
fileRes.childNotFound = NoResource()
station1.putChild('application.wadl', fileRes)
retn = False
try:
# start listen for incoming request
reactor.listenTCP(self._port, Site(root), self._connections,
self._listenAddress)
# start processing
Logging.info("start listening")
log.addObserver(logSC3)
reactor.run()
retn = True
except Exception, e:
Logging.error(str(e))
示例9: run
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def run(self):
modeStr = None
if self._evaluationMode is not None:
modeStr = DataModel.EEvaluationModeNames.name(self._evaluationMode)
whitelistStr = "<None>"
if self._eventTypeWhitelist is not None:
whitelistStr = ", ".join(self._eventTypeWhitelist)
blacklistStr = "<None>"
if self._eventTypeBlacklist is not None:
blacklistStr = ", ".join(self._eventTypeBlacklist)
stationFilterStr = "<None>"
if self._stationFilter is not None:
stationFilterStr = self._stationFilter
dataSelectFilterStr = "<None>"
if self._dataSelectFilter is not None:
dataSelectFilterStr = self._dataSelectFilter
Logging.debug("\n" \
"configuration read:\n" \
" serve\n" \
" dataselect : %s\n" \
" event : %s\n" \
" station : %s\n" \
" listenAddress : %s\n" \
" port : %i\n" \
" connections : %i\n" \
" htpasswd : %s\n" \
" accessLog : %s\n" \
" queryObjects : %i\n" \
" realtimeGap : %s\n" \
" samples (M) : %s\n" \
" allowRestricted : %s\n" \
" useArclinkAccess: %s\n" \
" hideAuthor : %s\n" \
" evaluationMode : %s\n" \
" eventType\n" \
" whitelist : %s\n" \
" blacklist : %s\n" \
" inventory filter\n" \
" station : %s\n" \
" dataSelect : %s\n" \
" debug enabled : %s\n" \
" trackdb\n" \
" enabled : %s\n" \
" defaultUser : %s\n" \
" auth\n" \
" enabled : %s\n" \
" gnupgHome : %s\n" % (
self._serveDataSelect, self._serveEvent,
self._serveStation, self._listenAddress, self._port,
self._connections, self._htpasswd, self._accessLogFile,
self._queryObjects, self._realtimeGap, self._samplesM,
self._allowRestricted, self._useArclinkAccess,
self._hideAuthor, modeStr,
whitelistStr, blacklistStr, stationFilterStr,
dataSelectFilterStr, self._debugFilter,
self._trackdbEnabled, self._trackdbDefaultUser,
self._authEnabled, self._authGnupgHome))
if not self._serveDataSelect and not self._serveEvent and \
not self._serveStation:
Logging.error("all services disabled through configuration")
return False
# access logger if requested
if self._accessLogFile:
self._accessLog = Log(self._accessLogFile)
# load inventory needed by DataSelect and Station service
stationInv = dataSelectInv = None
if self._serveDataSelect or self._serveStation:
retn = False
stationInv = dataSelectInv = Inventory.Instance().inventory()
Logging.info("inventory loaded")
if self._serveDataSelect and self._serveStation:
# clone inventory if station and dataSelect filter are distinct
# else share inventory between both services
if self._stationFilter != self._dataSelectFilter:
dataSelectInv = self._cloneInventory(stationInv)
retn = self._filterInventory(stationInv, self._stationFilter, "station") and \
self._filterInventory(dataSelectInv, self._dataSelectFilter, "dataSelect")
else:
retn = self._filterInventory(stationInv, self._stationFilter)
elif self._serveStation:
retn = self._filterInventory(stationInv, self._stationFilter)
else:
retn = self._filterInventory(dataSelectInv, self._dataSelectFilter)
if not retn:
return False
if self._serveDataSelect:
self._access.initFromSC3Routing(self.query().loadRouting())
DataModel.PublicObject.SetRegistrationEnabled(False)
shareDir = os.path.join(Environment.Instance().shareDir(), 'fdsnws')
# Overwrite/set mime type of *.wadl and *.xml documents. Instead of
# using the official types defined in /etc/mime.types 'application/xml'
#.........这里部分代码省略.........
示例10: _sighupHandler
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def _sighupHandler(self, signum, frame):
Logging.info("SIGHUP received")
self.__sighup = True
示例11: dump
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def dump(self):
Logging.info("known users:")
for name, user in self.__users.items():
Logging.info(" %s %s %d" % (name, user[1], user[2]))
示例12: blacklistUser
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def blacklistUser(self, name):
Logging.info("blacklisting %s" % name)
self.__blacklist.add(name)
示例13: __expireUsers
# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import info [as 别名]
def __expireUsers(self):
for (name, (password, attributes, expires)) in self.__users.items():
if time.time() > expires:
Logging.info("de-registering %s" % name)
del self.__users[name]