本文整理汇总了Python中mod_pywebsocket.util.get_class_logger函数的典型用法代码示例。如果您正苦于以下问题:Python get_class_logger函数的具体用法?Python get_class_logger怎么用?Python get_class_logger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_class_logger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(
self, root_dir, scan_dir=None,
allow_handlers_outside_root_dir=True):
"""Construct an instance.
Args:
root_dir: The directory where handler definition files are
placed.
scan_dir: The directory where handler definition files are
searched. scan_dir must be a directory under root_dir,
including root_dir itself. If scan_dir is None,
root_dir is used as scan_dir. scan_dir can be useful
in saving scan time when root_dir contains many
subdirectories.
allow_handlers_outside_root_dir: Scans handler files even if their
canonical path is not under root_dir.
"""
self._logger = util.get_class_logger(self)
self._handler_suite_map = {}
self._source_warnings = []
if scan_dir is None:
scan_dir = root_dir
if not os.path.realpath(scan_dir).startswith(
os.path.realpath(root_dir)):
raise DispatchException('scan_dir:%s must be a directory under '
'root_dir:%s.' % (scan_dir, root_dir))
self._source_handler_files_in_dir(
root_dir, scan_dir, allow_handlers_outside_root_dir)
示例2: __init__
def __init__(self, options):
"""Override SocketServer.TCPServer.__init__ to set SSL enabled
socket object to self.socket before server_bind and server_activate,
if necessary.
"""
# Share a Dispatcher among request handlers to save time for
# instantiation. Dispatcher can be shared because it is thread-safe.
options.dispatcher = dispatch.Dispatcher(
options.websock_handlers, options.scan_dir, options.allow_handlers_outside_root_dir
)
if options.websock_handlers_map_file:
_alias_handlers(options.dispatcher, options.websock_handlers_map_file)
warnings = options.dispatcher.source_warnings()
if warnings:
for warning in warnings:
logging.warning("Warning in source loading: %s" % warning)
self._logger = util.get_class_logger(self)
self.request_queue_size = options.request_queue_size
self.__ws_is_shut_down = threading.Event()
self.__ws_serving = False
SocketServer.BaseServer.__init__(self, (options.server_host, options.port), WebSocketRequestHandler)
# Expose the options object to allow handler objects access it. We name
# it with websocket_ prefix to avoid conflict.
self.websocket_server_options = options
self._create_sockets()
self.server_bind()
self.server_activate()
示例3: __init__
def __init__(self, request, options):
"""Constructs an instance.
Args:
request: mod_python request.
"""
StreamBase.__init__(self, request)
self._logger = util.get_class_logger(self)
self._options = options
if self._options.deflate_stream:
self._logger.debug('Setup filter for deflate-stream')
self._request = util.DeflateRequest(self._request)
self._request.client_terminated = False
self._request.server_terminated = False
# Holds body of received fragments.
self._received_fragments = []
# Holds the opcode of the first fragment.
self._original_opcode = None
self._writer = FragmentedFrameBuilder(
self._options.mask_send, self._options.outgoing_frame_filters)
self._ping_queue = deque()
示例4: __init__
def __init__(self, request):
self._logger = util.get_class_logger(self)
self._request = request
self._response_window_bits = None
self._response_no_context_takeover = False
示例5: __init__
def __init__(self, request, options):
"""Constructs an instance.
Args:
request: mod_python request.
"""
StreamBase.__init__(self, request)
self._logger = util.get_class_logger(self)
self._options = options
self._request.client_terminated = False
self._request.server_terminated = False
# Holds body of received fragments.
self._received_fragments = []
# Holds the opcode of the first fragment.
self._original_opcode = None
self._writer = FragmentedFrameBuilder(
self._options.mask_send, self._options.outgoing_frame_filters,
self._options.encode_text_message_to_utf8)
self._ping_queue = deque()
示例6: __init__
def __init__(self, socket, options):
super(ClientHandshakeProcessor, self).__init__()
self._socket = socket
self._options = options
self._logger = util.get_class_logger(self)
示例7: __init__
def __init__(self, request, dispatcher, allowDraft75=False, strict=False):
"""Construct an instance.
Args:
request: mod_python request.
dispatcher: Dispatcher (dispatch.Dispatcher).
allowDraft75: allow draft 75 handshake protocol.
strict: Strictly check handshake request in draft 75.
Default: False. If True, request.connection must provide
get_memorized_lines method.
Handshaker will add attributes such as ws_resource in performing
handshake.
"""
self._logger = util.get_class_logger(self)
self._request = request
self._dispatcher = dispatcher
self._strict = strict
self._hybi07Handshaker = hybi06.Handshaker(request, dispatcher)
self._hybi00Handshaker = hybi00.Handshaker(request, dispatcher)
self._hixie75Handshaker = None
if allowDraft75:
self._hixie75Handshaker = draft75.Handshaker(
request, dispatcher, strict)
示例8: __init__
def __init__(self, request):
"""Construct PerMessageDeflateExtensionProcessor."""
ExtensionProcessorInterface.__init__(self, request)
self._logger = util.get_class_logger(self)
self._preferred_client_max_window_bits = None
self._client_no_context_takeover = False
示例9: __init__
def __init__(self, options, handshake, stream_class):
self._logger = util.get_class_logger(self)
self._options = options
self._socket = None
self._handshake = handshake
self._stream_class = stream_class
示例10: __init__
def __init__(self, request):
"""Construct an instance.
Args:
request: mod_python request.
"""
self._logger = util.get_class_logger(self)
self._request = request
示例11: __init__
def __init__(self, socket, options):
super(ClientHandshakeProcessorHybi00, self).__init__()
self._socket = socket
self._options = options
self._logger = util.get_class_logger(self)
if self._options.deflate_frame or self._options.use_permessage_deflate:
logging.critical("HyBi 00 doesn't support extensions.")
sys.exit(1)
示例12: __init__
def __init__(self, request_handler, use_tls):
"""Construct an instance.
Args:
request_handler: A WebSocketRequestHandler instance.
"""
self._logger = util.get_class_logger(self)
self._request_handler = request_handler
self.connection = _StandaloneConnection(request_handler)
self._use_tls = use_tls
示例13: __init__
def __init__(self, request, client_address, server):
self._logger = util.get_class_logger(self)
self._options = server.websocket_server_options
# Overrides CGIHTTPServerRequestHandler.cgi_directories.
self.cgi_directories = self._options.cgi_directories
# Replace CGIHTTPRequestHandler.is_executable method.
if self._options.is_executable_method is not None:
self.is_executable = self._options.is_executable_method
# This actually calls BaseRequestHandler.__init__.
CGIHTTPServer.CGIHTTPRequestHandler.__init__(self, request, client_address, server)
示例14: __init__
def __init__(self, request, dispatcher):
"""Construct an instance.
Args:
request: mod_python request.
dispatcher: Dispatcher (dispatch.Dispatcher).
Handshaker will add attributes such as ws_resource during handshake.
"""
self._logger = util.get_class_logger(self)
self._request = request
self._dispatcher = dispatcher
示例15: __init__
def __init__(self, configFile):
print "connection init"
self.configFile = configFile
self.dictionary=dict()
with open(self.configFile, 'r') as f:
for singleLine in f:
singleLine = singleLine.replace('\n','')
splitedLine = singleLine.split('=')
self.dictionary[splitedLine[0]] = splitedLine[1]
print self.dictionary
logging.basicConfig(level=logging.getLevelName(self.dictionary.get('log_level').upper()))
self._socket = None
self.received = Queue()
self.toSend = Queue()
self._logger = util.get_class_logger(self)