当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript logger.trace方法代码示例

本文整理汇总了TypeScript中core/logging.logger.trace方法的典型用法代码示例。如果您正苦于以下问题:TypeScript logger.trace方法的具体用法?TypeScript logger.trace怎么用?TypeScript logger.trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core/logging.logger的用法示例。


在下文中一共展示了logger.trace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: return

 return () => {
   if (this.retries[i] > 0) {
     logger.trace(`ImageURL failed to load ${this._url[i]} image, retrying in ${retry_timeout} ms`);
     setTimeout(() => img.src = this._url[i], retry_timeout);
   } else {
     logger.warn(`ImageURL unable to load ${this._url[i]} image after ${retry_attempts} retries`);
   }
   return this.retries[i] -= 1;
 };
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:9,代码来源:image_url.ts

示例2: paint

  paint(): void {
    if (this.is_paused)
      return

    logger.trace(`PlotCanvas.render() for ${this.model.id}`)

    // Prepare the canvas size, taking HIDPI into account. Note that this may cause a resize
    // of the canvas, which means that any previous calls to ctx.save() will be undone.
    this.canvas_view.prepare_canvas()

    const {document} = this.model
    if (document != null) {
      const interactive_duration = document.interactive_duration()
      const {plot} = this.model
      if (interactive_duration >= 0 && interactive_duration < plot.lod_interval) {
        setTimeout(() => {
          if (document.interactive_duration() > plot.lod_timeout) {
            document.interactive_stop(plot)
          }
          this.request_render()
        }, plot.lod_timeout)
      } else
        document.interactive_stop(plot)
    }

    for (const id in this.renderer_views) {
      const v = this.renderer_views[id]
      if (this.range_update_timestamp == null ||
          (v instanceof GlyphRendererView && v.set_data_timestamp > this.range_update_timestamp)) {
        this.update_dataranges()
        break
      }
    }

    // TODO (bev) OK this sucks, but the event from the solver update doesn't
    // reach the frame in time (sometimes) so force an update here for now
    // (mp) not only that, but models don't know about solver anymore, so
    // frame can't update its scales.
    this.model.frame.update_scales()

    const {ctx} = this.canvas_view
    const ratio = this.canvas.pixel_ratio

    // Set hidpi-transform
    ctx.save()   // Save default state, do *after* getting ratio, cause setting canvas.width resets transforms
    ctx.scale(ratio, ratio)
    ctx.translate(0.5, 0.5)

    const frame_box: FrameBox = [
      this.frame._left.value,
      this.frame._top.value,
      this.frame._width.value,
      this.frame._height.value,
    ]

    this._map_hook(ctx, frame_box)
    this._paint_empty(ctx, frame_box)

    this.prepare_webgl(ratio, frame_box)

    ctx.save()
    if (this.visuals.outline_line.doit) {
      this.visuals.outline_line.set_value(ctx)
      let [x0, y0, w, h] = frame_box
      // XXX: shrink outline region by 1px to make right and bottom lines visible
      // if they are on the edge of the canvas.
      if (x0 + w == this.canvas._width.value) {
        w -= 1
      }
      if (y0 + h == this.canvas._height.value) {
        h -= 1
      }
      ctx.strokeRect(x0, y0, w, h)
    }
    ctx.restore()

    this._paint_levels(ctx, ['image', 'underlay', 'glyph'], frame_box)
    this.blit_webgl(ratio)
    this._paint_levels(ctx, ['annotation'], frame_box)
    this._paint_levels(ctx, ['overlay'])

    if (this._initial_state_info.range == null)
      this.set_initial_range()

    ctx.restore()   // Restore to default state

    if (!this._has_finished) {
      this._has_finished = true
      this.notify_finished()
    }
  }
开发者ID:gully,项目名称:bokeh,代码行数:91,代码来源:plot_canvas.ts

示例3: render


//.........这里部分代码省略.........
        if (includes(inspected, this.all_indices[i])) {
          result.push(i);
        }
      }
      return result;
    })());

    const { lod_threshold } = this.plot_model.plot;
    if (((this.model.document != null ? this.model.document.interactive_duration() : undefined) > 0) && !glsupport && (lod_threshold != null) && (this.all_indices.length > lod_threshold)) {
      // Render decimated during interaction if too many elements and not using GL
      indices = this.decimated;
      glyph = this.decimated_glyph;
      nonselection_glyph = this.decimated_glyph;
      ({ selection_glyph } = this);
    } else {
      glyph = this.model.muted && (this.muted_glyph != null) ? this.muted_glyph : this.glyph;
      ({ nonselection_glyph } = this);
      ({ selection_glyph } = this);
    }

    if ((this.hover_glyph != null) && inspected.length) {
      indices = difference(indices, inspected);
    }

    if (!(selected.length && this.have_selection_glyphs())) {
        trender = Date.now();
        if (this.glyph instanceof LineView) {
          if (this.hover_glyph && inspected.length) {
            this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected), this.glyph);
          } else {
            glyph.render(ctx, this.all_indices, this.glyph);
          }
        } else {
          glyph.render(ctx, indices, this.glyph);
          if (this.hover_glyph && inspected.length) {
            this.hover_glyph.render(ctx, inspected, this.glyph);
          }
        }
        dtrender = Date.now() - trender;

    } else {
      // reset the selection mask
      const tselect = Date.now();
      const selected_mask = {};
      for (const i of selected) {
        selected_mask[i] = true;
      }

      // intersect/different selection with render mask
      selected = new Array();
      const nonselected = new Array();

      // now, selected is changed to subset space, except for Line glyph
      if (this.glyph instanceof LineView) {
        for (const i of this.all_indices) {
          if (selected_mask[i] != null) {
            selected.push(i);
          } else {
            nonselected.push(i);
          }
        }
      } else {
        for (const i of indices) {
          if (selected_mask[this.all_indices[i]] != null) {
            selected.push(i);
          } else {
            nonselected.push(i);
          }
        }
      }
      dtselect = Date.now() - tselect;

      trender = Date.now();
      nonselection_glyph.render(ctx, nonselected, this.glyph);
      selection_glyph.render(ctx, selected, this.glyph);
      if (this.hover_glyph != null) {
        if (this.glyph instanceof LineView) {
          this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected), this.glyph);
        } else {
          this.hover_glyph.render(ctx, inspected, this.glyph);
        }
      }
      dtrender = Date.now() - trender;
    }

    this.last_dtrender = dtrender;

    const dttot = Date.now() - t0;
    logger.debug(`${this.glyph.model.type} GlyphRenderer (${this.model.id}): render finished in ${dttot}ms`);
    logger.trace(` - map_data finished in       : ${dtmap}ms`);
    if (dtmask != null) {
      logger.trace(` - mask_data finished in      : ${dtmask}ms`);
    }
    if (dtselect != null) {
      logger.trace(` - selection mask finished in : ${dtselect}ms`);
    }
    logger.trace(` - glyph renders finished in  : ${dtrender}ms`);

    return ctx.restore();
  }
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:101,代码来源:glyph_renderer.ts

示例4: paint

  paint() {
    let ratio;
    if (this.is_paused) {
      return;
    }

    logger.trace(`PlotCanvas.render() for ${this.model.id}`);

    // Prepare the canvas size, taking HIDPI into account. Note that this may cause a resize
    // of the canvas, which means that any previous calls to ctx.save() will be undone.
    this.canvas_view.prepare_canvas();

    if (this.model.document != null) {
      const interactive_duration = this.model.document.interactive_duration();
      if ((interactive_duration >= 0) && (interactive_duration < this.model.plot.lod_interval)) {
        const { lod_timeout } = this.model.plot;
        setTimeout(() => {
            if (this.model.document.interactive_duration() > lod_timeout) {
              this.model.document.interactive_stop(this.model.plot);
            }
            return this.request_render();
          }
          , lod_timeout);
      } else {
        this.model.document.interactive_stop(this.model.plot);
      }
    }

    for (const k in this.renderer_views) {
      const v = this.renderer_views[k];
      if ((this.range_update_timestamp == null) || (v.set_data_timestamp > this.range_update_timestamp)) {
        this.update_dataranges();
        break;
      }
    }

    // TODO (bev) OK this sucks, but the event from the solver update doesn't
    // reach the frame in time (sometimes) so force an update here for now
    // (mp) not only that, but models don't know about solver anymore, so
    // frame can't update its scales.
    this.model.frame.update_scales();

    const { ctx } = this.canvas_view;
    ctx.pixel_ratio = (ratio = this.canvas.pixel_ratio);  // Also store on cts for WebGL

    // Set hidpi-transform
    ctx.save();  // Save default state, do *after* getting ratio, cause setting canvas.width resets transforms
    ctx.scale(ratio, ratio);
    ctx.translate(0.5, 0.5);

    const frame_box: FrameBox = [
      this.frame._left.value,
      this.frame._top.value,
      this.frame._width.value,
      this.frame._height.value,
    ];

    this._map_hook(ctx, frame_box);
    this._paint_empty(ctx, frame_box);

    this.prepare_webgl(ratio, frame_box);

    ctx.save();
    if (this.visuals.outline_line.doit) {
      this.visuals.outline_line.set_value(ctx);
      let [x0, y0, w, h] = frame_box;
      // XXX: shrink outline region by 1px to make right and bottom lines visible
      // if they are on the edge of the canvas.
      if ((x0 + w) === this.canvas._width.value) {
        w -= 1;
      }
      if ((y0 + h) === this.canvas._height.value) {
        h -= 1;
      }
      ctx.strokeRect(x0, y0, w, h);
    }
    ctx.restore();

    this._paint_levels(ctx, ['image', 'underlay', 'glyph'], frame_box);
    this.blit_webgl(ratio);
    this._paint_levels(ctx, ['annotation'], frame_box);
    this._paint_levels(ctx, ['overlay']);

    if ((this.initial_range_info == null)) {
      this.set_initial_range();
    }

    ctx.restore();  // Restore to default state

    if (!this._has_finished) {
      this._has_finished = true;
      return this.notify_finished();
    }
  }
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:94,代码来源:plot_canvas.ts

示例5: render


//.........这里部分代码省略.........
    const inspected_subset_indices: number[] = ((() => {
      const result = []
      for (const i of indices) {
        if (includes(inspected_full_indices, this.all_indices[i]))
          result.push(i)
      }
      return result
    })())

    const {lod_threshold} = this.plot_model
    let glyph: GlyphView
    let nonselection_glyph: GlyphView
    let selection_glyph: GlyphView
    if ((this.model.document != null ? this.model.document.interactive_duration() > 0 : false)
        && !glsupport && lod_threshold != null && this.all_indices.length > lod_threshold) {
      // Render decimated during interaction if too many elements and not using GL
      indices = this.decimated
      glyph = this.decimated_glyph
      nonselection_glyph = this.decimated_glyph
      selection_glyph = this.selection_glyph
    } else {
      glyph = this.model.muted && this.muted_glyph != null ? this.muted_glyph : this.glyph
      nonselection_glyph = this.nonselection_glyph
      selection_glyph = this.selection_glyph
    }

    if (this.hover_glyph != null && inspected_subset_indices.length)
      indices = difference(indices, inspected_subset_indices)

    // Render with no selection
    let dtselect: number | null = null
    let trender: number
    if (!(selected_full_indices.length && this.have_selection_glyphs())) {
      trender = Date.now()
      if (this.glyph instanceof LineView) {
        if (this.hover_glyph && inspected_subset_indices.length)
          this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph)
        else
          glyph.render(ctx, this.all_indices, this.glyph)
      } else {
        glyph.render(ctx, indices, this.glyph)
        if (this.hover_glyph && inspected_subset_indices.length)
          this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph)
      }
    // Render with selection
    } else {
      // reset the selection mask
      const tselect = Date.now()
      const selected_mask: {[key: number]: boolean} = {}
      for (const i of selected_full_indices) {
        selected_mask[i] = true
      }

      // intersect/different selection with render mask
      const selected_subset_indices: number[] = new Array()
      const nonselected_subset_indices: number[] = new Array()

      // now, selected is changed to subset space, except for Line glyph
      if (this.glyph instanceof LineView) {
        for (const i of this.all_indices) {
          if (selected_mask[i] != null)
            selected_subset_indices.push(i)
          else
            nonselected_subset_indices.push(i)
        }
      } else {
        for (const i of indices) {
          if (selected_mask[this.all_indices[i]] != null)
            selected_subset_indices.push(i)
          else
            nonselected_subset_indices.push(i)
        }
      }
      dtselect = Date.now() - tselect

      trender = Date.now()
      nonselection_glyph.render(ctx, nonselected_subset_indices, this.glyph)
      selection_glyph.render(ctx, selected_subset_indices, this.glyph)
      if (this.hover_glyph != null) {
        if (this.glyph instanceof LineView)
          this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph)
        else
          this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph)
      }
    }
    const dtrender = Date.now() - trender

    this.last_dtrender = dtrender

    const dttot = Date.now() - t0
    logger.debug(`${this.glyph.model.type} GlyphRenderer (${this.model.id}): render finished in ${dttot}ms`)
    logger.trace(` - map_data finished in       : ${dtmap}ms`)
    logger.trace(` - mask_data finished in      : ${dtmask}ms`)
    if (dtselect != null) {
      logger.trace(` - selection mask finished in : ${dtselect}ms`)
    }
    logger.trace(` - glyph renders finished in  : ${dtrender}ms`)

    return ctx.restore()
  }
开发者ID:jsignell,项目名称:bokeh,代码行数:101,代码来源:glyph_renderer.ts


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