• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python logger.info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyftpdlib.log.logger.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _log_start

    def _log_start(self):
        if (not logging.getLogger('pyftpdlib').handlers and not
                logging.root.handlers):
            # If we get to this point it means the user hasn't
            # configured any logger. We want logging to be on
            # by default (stderr).
            from pyftpdlib.ioloop import _config_logging
            _config_logging()

        if self.handler.passive_ports:
            pasv_ports = "%s->%s" % (self.handler.passive_ports[0],
                                     self.handler.passive_ports[-1])
        else:
            pasv_ports = None
        addr = self.address
        if hasattr(self.handler, 'ssl_protocol'):
            proto = "FTP+SSL"
        else:
            proto = "FTP"
        logger.info(">>> starting %s server on %s:%s, pid=%i <<<"
                    % (proto, addr[0], addr[1], os.getpid()))
        logger.info("poller: %r", self.ioloop.__class__)
        logger.info("masquerade (NAT) address: %s",
                    self.handler.masquerade_address)
        logger.info("passive ports: %s", pasv_ports)
        if os.name == 'posix':
            logger.info("use sendfile(2): %s", self.handler.use_sendfile)
开发者ID:radhit,项目名称:pyftpdlib,代码行数:27,代码来源:servers.py


示例2: serve_forever

    def serve_forever(self, timeout=None, blocking=True, handle_exit=True):
        """Start serving.

         - (float) timeout: the timeout passed to the underlying IO
           loop expressed in seconds (default 1.0).

         - (bool) blocking: if False loop once and then return the
           timeout of the next scheduled call next to expire soonest
           (if any).

         - (bool) handle_exit: when True catches KeyboardInterrupt and
           SystemExit exceptions (generally caused by SIGTERM / SIGINT
           signals) and gracefully exits after cleaning up resources.
           Also, logs server start and stop.
        """
        if handle_exit:
            log = handle_exit and blocking
            if log:
                self._log_start()
            try:
                self.ioloop.loop(timeout, blocking)
            except (KeyboardInterrupt, SystemExit):
                pass
            if blocking:
                if log:
                    logger.info(
                        ">>> shutting down FTP server (%s active fds) <<<",
                        self._map_len())
                self.close_all()
        else:
            self.ioloop.loop(timeout, blocking)
开发者ID:Heribertosgp,项目名称:pyftpdlib,代码行数:31,代码来源:servers.py


示例3: serve_forever

 def serve_forever(self, timeout=None, blocking=True, handle_exit=True):
     self._exit.clear()
     if handle_exit:
         log = handle_exit and blocking == True
         if log:
             self._log_start()
         try:
             self.ioloop.loop(timeout, blocking)
         except (KeyboardInterrupt, SystemExit):
             pass
         if blocking:
             if log:
                 logger.info(">>> shutting down FTP server (%s active " "workers) <<<", self._map_len())
             self.close_all()
     else:
         self.ioloop.loop(timeout, blocking)
开发者ID:rkoewer,项目名称:HoneyConnector,代码行数:16,代码来源:servers.py


示例4: serve_forever

 def serve_forever(self, timeout=None, blocking=True, handle_exit=True):
     if handle_exit:
         log = handle_exit and blocking
         if log:
             self._log_start()
         try:
             self.ioloop.loop(timeout, blocking)
         except (KeyboardInterrupt, SystemExit):
             logger.info("received interrupt signal")
         if blocking:
             if log:
                 logger.info(
                     ">>> shutting down FTP server (%s active socket "
                     "fds) <<<",
                     self._map_len())
             self.close_all()
     else:
         self.ioloop.loop(timeout, blocking)
开发者ID:zhizhi100,项目名称:shuttleftp,代码行数:18,代码来源:demo.py


示例5: _log_start

    def _log_start(self):
        if not logging.getLogger().handlers:
            # If we get to this point it means the user hasn't
            # configured logger. We want to log by default so
            # we configure logging ourselves so that it will
            # print to stderr.
            from pyftpdlib.ioloop import _config_logging

            _config_logging()

        if self.handler.passive_ports:
            pasv_ports = "%s->%s" % (self.handler.passive_ports[0], self.handler.passive_ports[-1])
        else:
            pasv_ports = None
        logger.info(">>> starting FTP server on %s:%s <<<" % self.address)
        logger.info("poller: %r", self.ioloop.__class__)
        logger.info("masquerade (NAT) address: %s", self.handler.masquerade_address)
        logger.info("passive ports: %s", pasv_ports)
        if os.name == "posix":
            logger.info("use sendfile(2): %s", self.handler.use_sendfile)
开发者ID:rkoewer,项目名称:HoneyConnector,代码行数:20,代码来源:servers.py


示例6: _log_start

 def _log_start(self):
     FTPServer._log_start(self)
     logger.info("dispatcher: %r", self.__class__)
开发者ID:Heribertosgp,项目名称:pyftpdlib,代码行数:3,代码来源:servers.py


示例7: _loop

    def _loop(self, handler):
        """Serve handler's IO loop in a separate thread or process."""
        ioloop = IOLoop()
        try:
            handler.ioloop = ioloop
            try:
                handler.add_channel()
            except EnvironmentError:
                err = sys.exc_info()[1]
                if err.errno == errno.EBADF:
                    # we might get here in case the other end quickly
                    # disconnected (see test_quick_connect())
                    return
                else:
                    raise

            # Here we localize variable access to minimize overhead.
            poll = ioloop.poll
            sched_poll = ioloop.sched.poll
            poll_timeout = getattr(self, 'poll_timeout', None)
            soonest_timeout = poll_timeout

            while (ioloop.socket_map or ioloop.sched._tasks) and \
                    not self._exit.is_set():
                try:
                    if ioloop.socket_map:
                        poll(timeout=soonest_timeout)
                    if ioloop.sched._tasks:
                        soonest_timeout = sched_poll()
                        # Handle the case where socket_map is emty but some
                        # cancelled scheduled calls are still around causing
                        # this while loop to hog CPU resources.
                        # In theory this should never happen as all the sched
                        # functions are supposed to be cancel()ed on close()
                        # but by using threads we can incur into
                        # synchronization issues such as this one.
                        # https://github.com/giampaolo/pyftpdlib/issues/245
                        if not ioloop.socket_map:
                            # get rid of cancel()led calls
                            ioloop.sched.reheapify()
                            soonest_timeout = sched_poll()
                            if soonest_timeout:
                                time.sleep(min(soonest_timeout, 1))
                    else:
                        soonest_timeout = None
                except (KeyboardInterrupt, SystemExit):
                    # note: these two exceptions are raised in all sub
                    # processes
                    self._exit.set()
                except select.error:
                    # on Windows we can get WSAENOTSOCK if the client
                    # rapidly connect and disconnects
                    err = sys.exc_info()[1]
                    if os.name == 'nt' and err.args[0] == 10038:
                        for fd in list(ioloop.socket_map.keys()):
                            try:
                                select.select([fd], [], [], 0)
                            except select.error:
                                try:
                                    logger.info("discarding broken socket %r",
                                                ioloop.socket_map[fd])
                                    del ioloop.socket_map[fd]
                                except KeyError:
                                    # dict changed during iteration
                                    pass
                    else:
                        raise
                else:
                    if poll_timeout:
                        if (soonest_timeout is None
                                or soonest_timeout > poll_timeout):
                            soonest_timeout = poll_timeout
        finally:
            ioloop.close()
开发者ID:Heribertosgp,项目名称:pyftpdlib,代码行数:74,代码来源:servers.py


示例8: log

def log(msg):
    _depwarn("pyftpdlib.ftpserver.log() is deprecated")
    logger.info(msg)
开发者ID:Strangemother,项目名称:ftp,代码行数:3,代码来源:ftpserver.py


示例9: _loop

    def _loop(self, handler):
        """Serve handler's IO loop in a separate thread or process."""
        ioloop = IOLoop()
        try:
            handler.ioloop = ioloop
            try:
                handler.add_channel()
            except EnvironmentError:
                err = sys.exc_info()[1]
                if err.errno == errno.EBADF:
                    # we might get here in case the other end quickly
                    # disconnected (see test_quick_connect())
                    return
                else:
                    raise

            # Here we localize variable access to minimize overhead.
            poll = ioloop.poll
            socket_map = ioloop.socket_map
            tasks = ioloop.sched._tasks
            sched_poll = ioloop.sched.poll
            poll_timeout = getattr(self, "poll_timeout", None)
            soonest_timeout = poll_timeout

            while (socket_map or tasks) and not self._exit.is_set():
                try:
                    if socket_map:
                        poll(timeout=soonest_timeout)
                    if tasks:
                        soonest_timeout = sched_poll()
                    else:
                        soonest_timeout = None
                except (KeyboardInterrupt, SystemExit):
                    # note: these two exceptions are raised in all sub
                    # processes
                    self._exit.set()
                except select.error:
                    # on Windows we can get WSAENOTSOCK if the client
                    # rapidly connect and disconnects
                    err = sys.exc_info()[1]
                    if os.name == "nt" and err.args[0] == 10038:
                        for fd in list(socket_map.keys()):
                            try:
                                select.select([fd], [], [], 0)
                            except select.error:
                                try:
                                    logger.info("discarding broken socket %r", socket_map[fd])
                                    del socket_map[fd]
                                except KeyError:
                                    # dict changed during iteration
                                    pass
                    else:
                        raise
                else:
                    if poll_timeout:
                        if soonest_timeout is None or soonest_timeout > poll_timeout:
                            soonest_timeout = poll_timeout
        finally:
            try:
                self._active_tasks.remove(self._current_task())
            except ValueError:
                pass
            ioloop.close()
开发者ID:rkoewer,项目名称:HoneyConnector,代码行数:63,代码来源:servers.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python servers.FTPServer类代码示例发布时间:2022-05-25
下一篇:
Python authorizers.DummyAuthorizer类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap