本文整理匯總了Python中twisted.logger.LogLevel.debug方法的典型用法代碼示例。如果您正苦於以下問題:Python LogLevel.debug方法的具體用法?Python LogLevel.debug怎麽用?Python LogLevel.debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類twisted.logger.LogLevel
的用法示例。
在下文中一共展示了LogLevel.debug方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: boot_vendors
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def boot_vendors(self):
"""
Boot all enabled vendors.
"""
vendors = list(self.get_vendors())
log.info('Enabling vendors {vendors}', vendors=vendors)
debug = self.settings.options.debug
for vendor in vendors:
if hasattr(VendorBootloader, vendor):
log.info(u'Starting vendor environment for "{vendor}"', vendor=vendor)
bootloader = getattr(VendorBootloader, vendor)
try:
bootloader(self.settings)
except Exception as ex:
log.failure(
'Error booting vendor environment for "{vendor}"":\n{log_failure}"', vendor=vendor)
else:
message = 'Vendor environment for "{vendor}" missing.'.format(vendor=vendor)
log.critical(message)
示例2: test_capture
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def test_capture(self):
"""
Events logged within context are captured.
"""
foo = object()
with capturedLogs() as captured:
self.log.debug("Capture this, please", foo=foo)
self.log.info("Capture this too, please", foo=foo)
self.assertTrue(len(captured) == 2)
self.assertEqual(captured[0]["log_format"], "Capture this, please")
self.assertEqual(captured[0]["log_level"], LogLevel.debug)
self.assertEqual(captured[0]["foo"], foo)
self.assertEqual(captured[1]["log_format"], "Capture this too, please")
self.assertEqual(captured[1]["log_level"], LogLevel.info)
self.assertEqual(captured[1]["foo"], foo)
示例3: main
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def main(argv=sys.argv, stderr=sys.stderr):
options = DKIMToolOptions()
options.parseOptions(argv[1:])
#
# Send logging output to stdout
#
observer = STDLibLogObserver()
observer.start()
if options["verbose"]:
log.levels().setLogLevelForNamespace("txdav.caldav.datastore.scheduling.ischedule.dkim", LogLevel.debug)
if options["key-gen"]:
_doKeyGeneration(options)
elif options["request"]:
reactor.callLater(0, _runInReactor, _doRequest, options)
reactor.run()
elif options["verify"]:
reactor.callLater(0, _runInReactor, _doVerify, options)
reactor.run()
else:
usage("Invalid options")
示例4: hydro2motion
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def hydro2motion(cls, settings):
from kotori.vendor.hydro2motion.database.influx import h2m_boot_influx_database
from kotori.vendor.hydro2motion.network.udp import h2m_boot_udp_adapter
from kotori.vendor.hydro2motion.web.server import boot_web
debug = settings.options.debug
boot_web(settings, debug=debug)
h2m_boot_udp_adapter(settings, debug=debug)
h2m_boot_influx_database(settings)
示例5: hiveeyes
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def hiveeyes(cls, settings):
from kotori.vendor.hiveeyes.application import hiveeyes_boot
debug = settings.options.debug
hiveeyes_boot(settings, debug=debug)
示例6: lst
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def lst(cls, settings):
from kotori.vendor.lst.application import lst_boot
debug = settings.options.debug
if settings.options.debug_vendor and 'lst' in read_list(settings.options.debug_vendor):
changeLogLevel('kotori.vendor.lst', LogLevel.debug)
lst_boot(settings)
示例7: _trace
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def _trace(self, *args, **kw):
# there is no "trace" level in Twisted -- but this whole
# method will be no-op'd unless we are at the 'trace' level.
self.debug(*args, txaio_trace=True, **kw)
示例8: test_logging
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def test_logging(self):
"""
Logging module configures properly.
"""
defaultLogLevel = Logger.filterPredicate.logLevelForNamespace(None)
self.assertNotEqual(
defaultLogLevel, LogLevel.error,
"This test assumes the default log level is not error."
)
config.setDefaults(DEFAULT_CONFIG)
config.reload()
self.assertEquals(Logger.filterPredicate.logLevelForNamespace(None), defaultLogLevel)
self.assertEquals(Logger.filterPredicate.logLevelForNamespace("some.namespace"), defaultLogLevel)
config.load(self.testConfig)
self.assertEquals(Logger.filterPredicate.logLevelForNamespace(None), LogLevel.error)
self.assertEquals(Logger.filterPredicate.logLevelForNamespace("some.namespace"), LogLevel.debug)
writePlist({}, self.testConfig)
config.reload()
self.assertEquals(Logger.filterPredicate.logLevelForNamespace(None), defaultLogLevel)
self.assertEquals(Logger.filterPredicate.logLevelForNamespace("some.namespace"), defaultLogLevel)
示例9: observe_tftp
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def observe_tftp(event, forwardTo=globalLogPublisher):
if "log_level" in event and event["log_level"] is LogLevel.info:
# Informational messages emitted by `python-tx-tftp` are, in the
# context of MAAS, debug level at most.
event["log_level"] = LogLevel.debug
forwardTo(event)
示例10: test_downgrades_informational_messages
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def test_downgrades_informational_messages(self):
event = make_event(log_level=LogLevel.info)
with TwistedLoggerFixture() as logger:
observe_tftp(event)
self.assertThat(logger.events, Contains(event))
self.assertThat(event["log_level"], Is(LogLevel.debug))
示例11: generateFreeBusyResponse
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def generateFreeBusyResponse(self, recipient, responses, organizerProp, uid, event_details):
# Extract the ATTENDEE property matching current recipient from the calendar data
cuas = recipient.record.calendarUserAddresses
attendeeProp = self.scheduler.calendar.getAttendeeProperty(cuas)
try:
fbresult = yield FreebusyQuery(
organizer=self.scheduler.organizer,
organizerProp=organizerProp,
recipient=recipient,
attendeeProp=attendeeProp,
uid=uid,
timerange=self.scheduler.timeRange,
excludeUID=self.scheduler.excludeUID,
logItems=self.scheduler.logItems,
event_details=event_details,
).generateAttendeeFreeBusyResponse()
except Exception as e:
log.failure(
"Could not determine free busy information for recipient {cuaddr}",
cuaddr=recipient.cuaddr, level=LogLevel.debug
)
log.error(
"Could not determine free busy information for recipient {cuaddr}: {ex}",
cuaddr=recipient.cuaddr, ex=e
)
err = HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldav_namespace, "recipient-permissions"),
"Could not determine free busy information",
))
responses.add(
recipient.cuaddr,
Failure(exc_value=err),
reqstatus=iTIPRequestStatus.NO_AUTHORITY
)
returnValue(False)
else:
responses.add(
recipient.cuaddr,
responsecode.OK,
reqstatus=iTIPRequestStatus.SUCCESS,
calendar=fbresult
)
returnValue(True)
示例12: _doRequest
# 需要導入模塊: from twisted.logger import LogLevel [as 別名]
# 或者: from twisted.logger.LogLevel import debug [as 別名]
def _doRequest(options):
if options["verbose"]:
log.levels().setLogLevelForNamespace("txdav.caldav.datastore.scheduling.ischedule.dkim", LogLevel.debug)
# Parse the HTTP file
with open(options["request"]) as f:
request = f.read()
method, uri, headers, stream = _parseRequest(request)
# Setup signing headers
sign_headers = options["signing"]
if sign_headers is None:
sign_headers = []
for hdr in ("Host", "Content-Type", "Originator", "Recipient+"):
if headers.hasHeader(hdr.rstrip("+")):
sign_headers.append(hdr)
else:
sign_headers = sign_headers.split(":")
dkim = DKIMRequest(
method,
uri,
headers,
stream,
options["domain"],
options["selector"],
options["key"],
options["algorithm"],
sign_headers,
True,
True,
False,
int(options["expire"]),
)
if options["fake-time"]:
dkim.time = "100"
dkim.expire = "200"
dkim.message_id = "1"
yield dkim.sign()
s = StringIO()
_writeRequest(dkim, s)
print(s.getvalue())