本文整理汇总了Python中bacpypes.debugging.ModuleLogger.debug方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleLogger.debug方法的具体用法?Python ModuleLogger.debug怎么用?Python ModuleLogger.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bacpypes.debugging.ModuleLogger
的用法示例。
在下文中一共展示了ModuleLogger.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ArgumentParser
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
#
# __main__
#
# parse the command line arguments
parser = ArgumentParser(description=__doc__)
parser.add_argument("-s", "--source", nargs="?", type=str, help="source address")
parser.add_argument(
"-d", "--destination", nargs="?", type=str, help="destination address"
)
parser.add_argument("--host", nargs="?", type=str, help="source or destination")
parser.add_argument("pcap", nargs="+", type=str, help="pcap file(s)")
args = parser.parse_args()
if _debug:
_log.debug("initialization")
if _debug:
_log.debug(" - args: %r", args)
# interpret the arguments
if args.source:
filterSource = Address(args.source)
if _debug:
_log.debug(" - filterSource: %r", filterSource)
if args.destination:
filterDestination = Address(args.destination)
if _debug:
_log.debug(" - filterDestination: %r", filterDestination)
if args.host:
filterHost = Address(args.host)
if _debug:
示例2: ReadPropertyMultipleACK
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
resp = ReadPropertyMultipleACK(context=apdu)
resp.listOfReadAccessResults = read_access_result_list
if _debug: ReadPropertyMultipleApplication._debug(" - resp: %r", resp)
# return the result
self.response(resp)
#
# __main__
#
try:
# parse the command line arguments
args = ConfigArgumentParser(description=__doc__).parse_args()
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)
# make a device object
this_device = LocalDeviceObject(
objectName=args.ini.objectname,
objectIdentifier=int(args.ini.objectidentifier),
maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),
segmentationSupported=args.ini.segmentationsupported,
vendorIdentifier=int(args.ini.vendoridentifier),
)
# build a bit string that knows about the bit names
pss = ServicesSupported()
pss['whoIs'] = 1
pss['iAm'] = 1
示例3: range
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
del requests[key]
else:
if _debug: ReadPropertySummary._debug(" - unmatched")
#
# __main__
#
try:
if ('--debug' in sys.argv):
indx = sys.argv.index('--debug')
for i in range(indx+1, len(sys.argv)):
ConsoleLogHandler(sys.argv[i])
del sys.argv[indx:]
if _debug: _log.debug("initialization")
# check for src
if ('--src' in sys.argv):
i = sys.argv.index('--src')
filterSource = Address(sys.argv[i+1])
if _debug: _log.debug(" - filterSource: %r", filterSource)
del sys.argv[i:i+2]
# check for dest
if ('--dest' in sys.argv):
i = sys.argv.index('--dest')
filterDestination = Address(sys.argv[i+1])
if _debug: _log.debug(" - filterDestination: %r", filterDestination)
del sys.argv[i:i+2]
示例4: ReadPropertyMultipleACK
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
if _debug: ReadPropertyMultipleApplication._debug(" - read_access_result: %r", read_access_result)
# add it to the list
read_access_result_list.append(read_access_result)
# this is a ReadPropertyMultiple ack
if not resp:
resp = ReadPropertyMultipleACK(context=apdu)
resp.listOfReadAccessResults = read_access_result_list
if _debug: ReadPropertyMultipleApplication._debug(" - resp: %r", resp)
# return the result
self.response(resp)
#
# __main__
#
try:
abstraction = DeviceAbstraction(args.interface, args.config)
application = abstraction.get_server_application()
_log.debug("running")
run()
except Exception, e:
_log.exception("an error has occurred: %s", e)
finally:
_log.debug("finally")
示例5: range
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
requests[key] = 1
#
# __main__
#
try:
if "--debug" in sys.argv:
indx = sys.argv.index("--debug")
for i in range(indx + 1, len(sys.argv)):
ConsoleLogHandler(sys.argv[i])
del sys.argv[indx:]
if _debug:
_log.debug("initialization")
# check for src
if "--src" in sys.argv:
i = sys.argv.index("--src")
filterSource = Address(sys.argv[i + 1])
if _debug:
_log.debug(" - filterSource: %r", filterSource)
del sys.argv[i : i + 2]
# check for dest
if "--dest" in sys.argv:
i = sys.argv.index("--dest")
filterDestination = Address(sys.argv[i + 1])
if _debug:
_log.debug(" - filterDestination: %r", filterDestination)
示例6: ArgumentParser
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
try:
# parse the command line arguments
parser = ArgumentParser(description=__doc__)
parser.add_argument("address",
help="address of socket",
)
parser.add_argument("--nobroadcast",
action="store_true",
dest="noBroadcast",
default=False,
help="do not create a broadcast socket",
)
args = parser.parse_args()
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)
if args.address == "any":
local_unicast_tuple = ('', 47808)
local_broadcast_tuple = ('255.255.255.255', 47808)
elif args.address.startswith("any:"):
port = int(args.address[4:])
local_unicast_tuple = ('', port)
local_broadcast_tuple = ('255.255.255.255', port)
else:
address = Address(args.address)
if _debug: _log.debug(" - local_address: %r", address)
示例7: Address
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
)
# add an argument for interval
parser.add_argument('addr2', type=str,
help='address of second network',
)
# add an argument for interval
parser.add_argument('net2', type=int,
help='network number of second network',
)
# now parse the arguments
args = parser.parse_args()
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)
local_address = Address(args.addr1)
local_network = args.net1
vlan_address = Address(args.addr2)
vlan_network = args.net2
# create the VLAN router, bind it to the local network
router = VLANRouter(local_address, local_network)
# create a VLAN
vlan = Network()
# create a node for the router, address 1 on the VLAN
router_node = Node(Address(1))
示例8: bacpypes_debugging
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
network_list = [int(arg) for arg in args[1:]]
# pass along to the service access point
this_application.nsap.add_router_references(adapter, router_address, network_list)
bacpypes_debugging(WhoIsIAmConsoleCmd)
#
# __main__
#
try:
# parse the command line arguments
args = ConfigArgumentParser(description=__doc__).parse_args()
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)
# make a device object
this_device = LocalDeviceObject(
objectName=args.ini.objectname,
objectIdentifier=int(args.ini.objectidentifier),
maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),
segmentationSupported=args.ini.segmentationsupported,
vendorIdentifier=int(args.ini.vendoridentifier),
)
# build a bit string that knows about the bit names
pss = ServicesSupported()
pss['whoIs'] = 1
pss['iAm'] = 1
示例9: xrange
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
for object_index in xrange(1,objectCount+1):
_log.debug('object_device_index = ' + repr(object_index))
bac_object = read_prop(this_application,
target_address,
"device",
device_id,
list_property,
index=object_index)
obj_type, index = bac_object
try:
process_object(this_application, target_address, obj_type, index, args.max_range_report, config_writer)
except:
_log.debug("Unexpected error processing object: {} {}".format(obj_type, index))
_log.debug(traceback.format_exc())
try:
main()
except Exception, e:
_log.exception("an error has occurred: %s", e)
finally:
_log.debug("finally")
示例10: range
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
# count the packets in the slot
counter[slot] += 1
#
# __main__
#
try:
if ('--debug' in sys.argv):
indx = sys.argv.index('--debug')
for i in range(indx+1, len(sys.argv)):
ConsoleLogHandler(sys.argv[i])
del sys.argv[indx:]
if _debug: _log.debug("initialization")
# check for a custom interval
if ('--interval' in sys.argv):
i = sys.argv.index('--interval')
interval = int(sys.argv[i+1])
if _debug: _log.debug(" - interval: %r", interval)
del sys.argv[i:i+2]
else:
interval = 60
# trace the file(s)
for fname in sys.argv[1:]:
trace(fname, [PDUsPerMinuteTracer])
# print some stats at the end
示例11: ModuleLogger
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
import sys
import logging
from ConfigParser import ConfigParser
from bacpypes.debugging import Logging, ModuleLogger
from bacpypes.consolelogging import ConsoleLogHandler
from bacpypes.core import run
from bacpypes.app import BIPSimpleApplication
from bacpypes.object import LocalDeviceObject
#debugging
_debug = 0
_log = ModuleLogger(globals())
#_main_
try:
_log.debug("initialization")
_log.debug("running")
except Exception, e:
_log.exception("an error has occured: %s", e)
finally:
_log.debug("finally")
示例12: register_object_type
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
# return where the 'writing' actually started
return start_position
register_object_type(LocalStreamAccessFileObject)
#
# __main__
#
try:
# parse the command line arguments
args = ConfigArgumentParser(description=__doc__).parse_args()
if _debug:
_log.debug("initialization")
if _debug:
_log.debug(" - args: %r", args)
# make a device object
this_device = LocalDeviceObject(
objectName=args.ini.objectname,
objectIdentifier=int(args.ini.objectidentifier),
maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),
segmentationSupported=args.ini.segmentationsupported,
vendorIdentifier=int(args.ini.vendoridentifier),
)
# make a sample application
this_application = BIPSimpleApplication(this_device, args.ini.address)
示例13: bacpypes_debugging
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
if self.pParameter == self.pSetPoint:
if _debug: SampleEventDetection._debug(" - parameter match")
else:
if _debug: SampleEventDetection._debug(" - parameter mismatch")
bacpypes_debugging(SampleEventDetection)
#
#
#
# parse the command line arguments
parser = ArgumentParser(usage=__doc__)
args = parser.parse_args()
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)
# analog value 1
av1 = AnalogValueObject(
objectIdentifier=('analogValue', 1),
presentValue=75.3,
)
if _debug: _log.debug(" - av1: %r", av1)
# add a very simple monitor
av1._property_monitors['presentValue'].append(
partial(something_changed, "av1"),
)
# test it
示例14: __init__
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
def __init__(self, **kwargs):
if _debug: RandomAnalogValueObject._debug("__init__ %r", kwargs)
AnalogValueObject.__init__(self, **kwargs)
register_object_type(RandomAnalogValueObject)
#
# __main__
#
try:
# parse the command line arguments
args = ConfigArgumentParser(description=__doc__).parse_args()
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)
# make a device object
this_device = LocalDeviceObject(
objectName=args.ini.objectname,
objectIdentifier=('device', int(args.ini.objectidentifier)),
maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),
segmentationSupported=args.ini.segmentationsupported,
vendorIdentifier=int(args.ini.vendoridentifier),
)
# make a sample application
this_application = BIPSimpleApplication(this_device, args.ini.address)
# get the services supported
示例15: ModuleLogger
# 需要导入模块: from bacpypes.debugging import ModuleLogger [as 别名]
# 或者: from bacpypes.debugging.ModuleLogger import debug [as 别名]
_debug = 0
_log = ModuleLogger(globals())
# globals
this_device = None
this_application = None
#
# __main__
#
try:
# parse the command line arguments
args = ConfigArgumentParser(description=__doc__).parse_args()
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)
# make a device object
this_device = LocalDeviceObject(
objectName=args.ini.objectname,
objectIdentifier=int(args.ini.objectidentifier),
maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),
segmentationSupported=args.ini.segmentationsupported,
vendorIdentifier=int(args.ini.vendoridentifier),
)
# make a sample application
this_application = BIPSimpleApplication(this_device, args.ini.address)
# make a multistate value object