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

Python app_log.debug函数代码示例

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

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



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

示例1: update_stats

def update_stats(stats):
    """Get updated stats for each host
    
    If a host fails to reply,
    assume it is is down and assign it zero availability and capacity
    """

    http_client = AsyncHTTPClient()
    futures = {}
    for host in stats.keys():
        app_log.debug("Checking stats on %s" % host)
        req = HTTPRequest(host + '/stats')
        futures[host] = http_client.fetch(req)
    
    for host, f in futures.items():
        try:
            reply = yield f
            data = json.loads(reply.body.decode('utf8'))
        except Exception as e:
            app_log.error("Failed to get stats for %s: %s", host, e)
            if host in stats:
                stats[host] = {'available': 0, 'capacity': 0, 'down': True}
        else:
            app_log.debug("Got stats from %s: %s", host, data)
            if host in stats:
                stats[host] = data
开发者ID:thewtex,项目名称:tmpnb-redirector,代码行数:26,代码来源:redirector.py


示例2: get_app_status

    def get_app_status(self, webOTT):
        params = {
            'status':      "new",
            'statusCode':  0,
            'userId':      "",
            'redirectURL': "",
            'authOTT': ""
        }

        I = self.storage.find(stage="auth", webOTT=webOTT)
        if not I:
            log.debug("Cannot find webOTT: {0}".format(webOTT))
            params['status'] = 'expired'
            return params

        if I.mobile_status:
            params['status'] = I.mobile_status

        if I.mobile_status == 'user' and I.userId:
            params['userId'] = I.userId

        authOTT = I.authOTT
        if authOTT and (str(I.status) == "200"):
            params['status'] = 'authenticate'
            params['authOTT'] = authOTT

        return params
开发者ID:apache,项目名称:incubator-milagro-mfa-server,代码行数:27,代码来源:mobile_flow.py


示例3: get

    def get(self, path=None):
        '''Spawns a brand new server'''

        try:
            if path is None:
                # No path. Assign a prelaunched container from the pool and redirect to it.
                # Append self.redirect_uri to the redirect target.
                container_path = self.pool.acquire().path
                app_log.info("Allocated [%s] from the pool.", container_path)

                url = "/{}/{}".format(container_path, self.redirect_uri)
            else:
                path_parts = path.lstrip('/').split('/', 1)
                container_path = path_parts[0]

                # Scrap a container from the pool and replace it with an ad-hoc replacement.
                # This takes longer, but is necessary to support ad-hoc containers
                yield self.pool.adhoc(container_path)

                app_log.info("Allocated ad-hoc container at [%s].", container_path)
                url = path

            app_log.debug("Redirecting [%s] -> [%s].", self.request.path, url)
            self.redirect(url, permanent=False)
        except spawnpool.EmptyPoolError:
            app_log.warning("The container pool is empty!")
            self.render("full.html", cull_period=self.cull_period)
开发者ID:Carreau,项目名称:tmpnb,代码行数:27,代码来源:orchestrate.py


示例4: finish_notebook

 def finish_notebook(self, nbjson, download_url, home_url=None, msg=None, breadcrumbs=None):
     """render a notebook from its JSON body.
     
     download_url is required, home_url is not.
     
     msg is extra information for the log message when rendering fails.
     """
     if msg is None:
         msg = download_url
     try:
         app_log.debug("Requesting render of %s", download_url)
         with self.time_block("Rendered %s" % download_url):
             nbhtml, config = yield self.pool.submit(
                 render_notebook, self.exporter, nbjson, download_url,
                 config=self.config,
             )
     except NbFormatError as e:
         app_log.error("Invalid notebook %s: %s", msg, e)
         raise web.HTTPError(400, str(e))
     except Exception as e:
         app_log.error("Failed to render %s", msg, exc_info=True)
         raise web.HTTPError(400, str(e))
     else:
         app_log.debug("Finished render of %s", download_url)
     
     html = self.render_template('notebook.html',
         body=nbhtml,
         download_url=download_url,
         home_url=home_url,
         date=datetime.utcnow().strftime(date_fmt),
         breadcrumbs=breadcrumbs,
         **config)
     yield self.cache_and_finish(html)
开发者ID:mariusvniekerk,项目名称:nbviewer,代码行数:33,代码来源:handlers.py


示例5: get

    def get(self):
        code = self.get_argument("code", False)
        if not code:
            raise HTTPError(400, "oauth callback made without a token")

        # validate OAuth state
        arg_state = self.get_argument("state", None)
        cookie_state = self.get_secure_cookie(self.hub_auth.state_cookie_name)
        next_url = None
        if arg_state or cookie_state:
            # clear cookie state now that we've consumed it
            self.clear_cookie(self.hub_auth.state_cookie_name)
            if isinstance(cookie_state, bytes):
                cookie_state = cookie_state.decode('ascii', 'replace')
            # check that state matches
            if arg_state != cookie_state:
                app_log.debug("oauth state %r != %r", arg_state, cookie_state)
                raise HTTPError(403, "oauth state does not match")
            next_url = self.hub_auth.get_next_url(cookie_state)
        # TODO: make async (in a Thread?)
        token = self.hub_auth.token_for_code(code)
        user_model = self.hub_auth.user_for_token(token)
        if user_model is None:
            raise HTTPError(500, "oauth callback failed to identify a user")
        app_log.info("Logged-in user %s", user_model)
        self.hub_auth.set_cookie(self, token)
        self.redirect(next_url or self.hub_auth.base_url)
开发者ID:angelapper,项目名称:jupyterhub,代码行数:27,代码来源:auth.py


示例6: remove_client

 def remove_client(cls, email):
     """
     移除client
     @param email:
     """
     app_log.debug("remove client[{0}]".format(email))
     del cls._CLIENTS_MAP[email]
开发者ID:cls1997,项目名称:chat,代码行数:7,代码来源:manager.py


示例7: delete_all_references

def delete_all_references(resource, schema, idl):
    """
    Delete all occurrences of reference for resource
    Parameters:
        resource - resource whose references are to be
                   deleted from the entire DB
        schema - ovsdb schema object
        idl = ovs.db.idl.Idl instance
    """
    row = get_row_from_resource(resource, idl)
    #We get the tables that reference the row to delete table
    tables_reference = schema.references_table_map[resource.table]
    #Get the table name and column list we is referenced
    for table_name, columns_list in tables_reference.iteritems():
        app_log.debug("Table %s" % table_name)
        app_log.debug("Column list %s" % columns_list)
        #Iterate each row to see wich tuple has the reference
        for uuid, row_ref in idl.tables[table_name].rows.iteritems():
            #Iterate over each reference column and check if has the reference
            for column_name in columns_list:
                #get the referenced values
                reflist = get_column_data_from_row(row_ref, column_name)
                if reflist is not None:
                    #delete the reference on that row and column
                    delete_row_reference(reflist, row, row_ref, column_name)
开发者ID:bluecmd,项目名称:ops-restd,代码行数:25,代码来源:utils.py


示例8: get

    def get(self, path=None):
        '''Spawns a brand new server'''
        if path is None:
            # no path, use random prefix
            prefix = "user-" + sample_with_replacement(string.ascii_letters +
                                                       string.digits)
        else:
            prefix = path.lstrip('/').split('/', 1)[0]

        self.write("Initializing {}".format(prefix))

        container_id, ip, port = yield self.spawner.create_notebook_server(prefix,
                image=self.image, ipython_executable=self.ipython_executable,
                mem_limit=self.mem_limit, cpu_shares=self.cpu_shares,
                container_ip=self.container_ip,
                container_port=self.container_port)

        app_log.debug(ip, port, prefix, container_id)
        yield self.proxy(ip, port, prefix, container_id)

        # Wait for the notebook server to come up.
        yield self.wait_for_server(ip, port, prefix)

        if path is None:
            # Redirect the user to the configured redirect location
            
            # Take out a leading slash
            redirect_uri = self.redirect_uri.lstrip("/")
            url = "/".join(("/{}".format(prefix), redirect_uri))
        else:
            url = path
            if not url.startswith('/'):
                url = '/' + url
        app_log.debug("redirecting %s -> %s", self.request.path, url)
        self.redirect(url, permanent=False)
开发者ID:gitter-badger,项目名称:tmpnb,代码行数:35,代码来源:orchestrate.py


示例9: prepare

    def prepare(self):

        app_log.debug("Incoming request from %s: %s",
                      self.request.remote_ip,
                      self.request)

        if settings['auth_enabled'] and self.request.method != "OPTIONS":
            is_authenticated = userauth.is_user_authenticated(self)
        else:
            is_authenticated = True

        if not is_authenticated:
            self.set_status(httplib.UNAUTHORIZED)
            self.set_header("Link", "/login")
            self.finish()
        else:
            self.resource_path = parse_url_path(self.request.path,
                                                self.schema,
                                                self.idl,
                                                self.request.method)

            if self.resource_path is None:
                self.set_status(httplib.NOT_FOUND)
                self.finish()
            else:
                #If Match support
                match = self.process_if_match()
                if not match:
                    self.finish()
开发者ID:bluecmd,项目名称:ops-restd,代码行数:29,代码来源:base.py


示例10: main

def main():
    """ entry """
    try:
        conf = __import__('conf')
    except ImportError as e:
        app_log.critical("Unable to load site config. ({})".format(e))
        raise SystemExit()
    parse_command_line()

    if options.debug:
        app_log.setLevel(logging.DEBUG)

    if not options.debug:
        fork_processes(None)
    options.port += task_id() or 0

    if not os.path.isdir(conf.app_path):
        app_log.critical("{p} isn't accessible, maybe "
                         "create it?".format(p=conf.app_path))
        raise SystemExit()
    app_log.debug("Starting {name} on port {port}".format(name=conf.name,
                                                          port=options.port))
    # initialize the application
    tornado.httpserver.HTTPServer(Application(options,
                                              conf)).listen(options.port,
                                                            '0.0.0.0')
    ioloop = tornado.ioloop.IOLoop.instance()
    if options.debug:
        tornado.autoreload.start(ioloop)
    # enter the Tornado IO loop
    ioloop.start()
开发者ID:sarahjanesllc-labs,项目名称:brutus,代码行数:31,代码来源:cli.py


示例11: load_by_name

 def load_by_name(self, name):
     try:
         return load_by_name('app.system.cmf.%s' % (name.lower(),),
                             name.capitalize())()
     except ImportError as e:
         app_log.debug(e)
         return False
开发者ID:battlemidget,项目名称:cage-cmf,代码行数:7,代码来源:handler.py


示例12: get

    def get(self, path=None):
        '''Spawns a brand new server'''
        if self.allow_origin:
            self.set_header("Access-Control-Allow-Origin", self.allow_origin)
        try:
            if path is None:
                # No path. Assign a prelaunched container from the pool and redirect to it.
                # Append self.redirect_uri to the redirect target.
                container_path = self.pool.acquire().path
                app_log.info("Allocated [%s] from the pool.", container_path)

                url = "/{}/{}".format(container_path, self.redirect_uri)
            else:
                # Split /user/{some_user}/long/url/path and acquire {some_user}
                path_parts = path.lstrip('/').split('/', 2)
                app_log.info("path parts: %s", path_parts)
                user = path_parts[1]

                # Scrap a container from the pool and replace it with an ad-hoc replacement.
                # This takes longer, but is necessary to support ad-hoc containers
                yield self.pool.adhoc(user, path_parts[-1])

                url = "/" + "/".join(path_parts[:2])
                app_log.info("new url: %s", url)

            app_log.debug("Redirecting [%s] -> [%s].", self.request.path, url)
            self.redirect(url, permanent=False)
        except spawnpool.EmptyPoolError:
            app_log.warning("The container pool is empty!")
            self.render("full.html", cull_period=self.cull_period)
开发者ID:betatim,项目名称:tmpnb,代码行数:30,代码来源:orchestrate.py


示例13: __init__

    def __init__(self, commons):
        self.commons = commons
        app_log.debug("Application path (%s)" % (self.commons['script_location'],))

        urls = [
            (r"/(.*)", tornado.web.StaticFileHandler,
             {"path" : os.path.join(self.commons['script_location'],
                                    'app',
                                    'index.html')}),
            (r"/partials/(.*)", tornado.web.StaticFileHandler,
             {"path" : os.path.join(self.commons['script_location'],
                                    'app',
                                    'partials')}),

        ]

        settings = dict(
            template_path=None,
            static_path=os.path.join(self.commons['script_location'],
                                     'app'),
            xsrf_cookies=False if options.debug else True,
            cookie_secret='i love my dog!',
            debug=options.debug,
            )
        tornado.web.Application.__init__(self, urls, **settings)
开发者ID:battlemidget,项目名称:tornado-angularjs-skel,代码行数:25,代码来源:app.py


示例14: cache_and_finish

    def cache_and_finish(self, content=""):
        """finish a request and cache the result
        
        does not actually call finish - if used in @web.asynchronous,
        finish must be called separately. But we never use @web.asynchronous,
        because we are using gen.coroutine for async.
        
        currently only works if:
        
        - result is not written in multiple chunks
        - custom headers are not used
        """
        self.write(content)
        short_url = self.truncate(self.request.path)
        cache_data = pickle.dumps({"headers": self.cache_headers, "body": content}, pickle.HIGHEST_PROTOCOL)
        request_time = self.request.request_time()
        # set cache expiry to 120x request time
        # bounded by cache_expiry_min,max
        # a 30 second render will be cached for an hour
        expiry = max(min(120 * request_time, self.cache_expiry_max), self.cache_expiry_min)

        if self.request.uri in self.max_cache_uris:
            # if it's a link from the front page, cache for a long time
            expiry = self.cache_expiry_max

        log = app_log.info if expiry > self.cache_expiry_min else app_log.debug
        log("caching (expiry=%is) %s", expiry, short_url)
        try:
            with self.time_block("cache set %s" % short_url):
                yield self.cache.set(self.cache_key, cache_data, int(time.time() + expiry))
        except Exception:
            app_log.error("cache set for %s failed", short_url, exc_info=True)
        else:
            app_log.debug("cache set finished %s", short_url)
开发者ID:B-Rich,项目名称:nbviewer,代码行数:34,代码来源:handlers.py


示例15: prepare

    def prepare(self):
        self._boundary = None
        self._boundary_length = None
        self._boundary_padding = 2
        self._sep = b'\r\n\r\n'
        self._disp_header = None
        self._disp_params = None
        self._disp_name = None
        self._disp_buffer = None
        self._buffer = None

        content_type = self.request.headers.get('content-type', '')
        if not content_type.startswith('multipart/form-data'):
            raise HTTPError(400)

        fields = content_type.split(';')
        for field in fields:
            k, sep, v = field.strip().partition('=')
            if k == 'boundary' and v:
                if v.startswith('"') and v.endswith('"'):
                    v = v[1:-1]
                self._boundary = b'--' + utf8(v)
                self._boundary_length = len(self._boundary) + self._boundary_padding
                break

        if self._boundary is None:
            raise HTTPError(400)

        app_log.debug('boundary: %s', self._boundary)
开发者ID:hurie,项目名称:Tornado-PyPi-Proxy,代码行数:29,代码来源:streaming_upload.py


示例16: main

def main():
    parse_command_line()
    settings = dict(
        pipeline_file=options.pipeline
    )
    app = remotecontrol.app.Application(settings)
    options.logging = str('DEBUG')
    enable_pretty_logging(options)
    app_log.setLevel(logging.DEBUG)

    server = HTTPServer(app)
    server.listen(options.port, options.host)
    app_log.info("Version: %s from: %s" % (remotecontrol.VERSION, remotecontrol.VERSION_DATE))
    app_log.info("Listen on http://%s:%d/" % (
        options.host if options.host != "" else "localhost",
        options.port)
    )
    # app.processor.start()
    second_tick = None
    try:
        tornado.autoreload.add_reload_hook(app.manager.stop)
        second_tick = tornado.ioloop.PeriodicCallback(lambda: app.second_tick(), 1000)
        second_tick.start()
        tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        second_tick.stop()
        app_log.info("stop second tick")
        app.manager.stop()
        tornado.ioloop.IOLoop.instance().stop()
    app_log.debug("Server shutdown.")
开发者ID:sv99,项目名称:v2r-buildroot-ext,代码行数:30,代码来源:server.py


示例17: wait_for_http_server

def wait_for_http_server(url, timeout=10):
    """Wait for an HTTP Server to respond at url
    
    Any non-5XX response code will do, even 404.
    """
    loop = ioloop.IOLoop.current()
    tic = loop.time()
    client = AsyncHTTPClient()
    while loop.time() - tic < timeout:
        try:
            r = yield client.fetch(url, follow_redirects=False)
        except HTTPError as e:
            if e.code >= 500:
                # failed to respond properly, wait and try again
                if e.code != 599:
                    # we expect 599 for no connection,
                    # but 502 or other proxy error is conceivable
                    app_log.warn("Server at %s responded with error: %s", url, e.code)
                yield gen.Task(loop.add_timeout, loop.time() + 0.25)
            else:
                app_log.debug("Server at %s responded with %s", url, e.code)
                return
        except (OSError, socket.error) as e:
            if e.errno not in {errno.ECONNABORTED, errno.ECONNREFUSED, errno.ECONNRESET}:
                app_log.warn("Failed to connect to %s (%s)", url, e)
            yield gen.Task(loop.add_timeout, loop.time() + 0.25)
        else:
            return
    
    raise TimeoutError("Server at {url} didn't respond in {timeout} seconds".format(
        **locals()
    ))
开发者ID:Josue-Martinez-Moreno,项目名称:jupyterhub,代码行数:32,代码来源:utils.py


示例18: verify_index

def verify_index(resource, parent, index_values, schema, idl):
    '''
        Verify if a resource exists in the DB Table using the index.
    '''

    if resource.table not in idl.tables:
        return None

    # check if we are dealing with key/value type of forward reference
    kv_type = False
    if parent is not None and parent.relation == OVSDB_SCHEMA_CHILD:
        if schema.ovs_tables[parent.table].references[parent.column].kv_type:
            kv_type = True

    if kv_type:
        # check in parent table that the index exists
        app_log.debug('verifying key/value type reference')
        row = utils.kv_index_to_row(index_values, parent, idl)
    else:
        dbtable = idl.tables[resource.table]
        table_schema = schema.ovs_tables[resource.table]

        row = utils.index_to_row(index_values, table_schema, dbtable)

    return row
开发者ID:bluecmd,项目名称:ops-restd,代码行数:25,代码来源:parse.py


示例19: cull_idle

def cull_idle(url, api_token, timeout):
    """cull idle single-user servers"""
    auth_header = {
            'Authorization': 'token %s' % api_token
        }
    req = HTTPRequest(url=url + '/api/users',
        headers=auth_header,
    )
    now = datetime.datetime.utcnow()
    cull_limit = now - datetime.timedelta(seconds=timeout)
    client = AsyncHTTPClient()
    resp = yield client.fetch(req)
    users = json.loads(resp.body.decode('utf8', 'replace'))
    futures = []
    for user in users:
        last_activity = parse_date(user['last_activity'])
        if user['server'] and last_activity < cull_limit:
            app_log.info("Culling %s (inactive since %s)", user['name'], last_activity)
            req = HTTPRequest(url=url + '/api/users/%s/server' % user['name'],
                method='DELETE',
                headers=auth_header,
            )
            futures.append((user['name'], client.fetch(req)))
        elif user['server'] and last_activity > cull_limit:
            app_log.debug("Not culling %s (active since %s)", user['name'], last_activity)

    for (name, f) in futures:
        yield f
        app_log.debug("Finished culling %s", name)
开发者ID:ctapobep,项目名称:docker-images,代码行数:29,代码来源:cull_idle_servers.py


示例20: get_request_type

 def get_request_type(self, query_args):
     app_log.debug('Query args: %s', query_args)
     if not query_args:
         return CONFIG_TYPE_RUNNING
     else:
         typearg = query_args.get("type", CONFIG_TYPE_RUNNING)
         return typearg[0]
开发者ID:chinhtle,项目名称:ops-restd,代码行数:7,代码来源:configcontroller.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python app_log.error函数代码示例发布时间:2022-05-27
下一篇:
Python log.enable_pretty_logging函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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