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

TypeScript Logger.child函数代码示例

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

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



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

示例1: async

 sanityCheck: async (versionPrefix: string) => {
   await spawn({
     ctx: new MinimalContext(),
     logger: rootLogger.child({ name: "itch-setup formula" }),
     command: ospath.join(versionPrefix, "itch-setup"),
     args: ["--version"],
   });
 },
开发者ID:HorrerGames,项目名称:itch,代码行数:8,代码来源:formulas.ts


示例2: function

import { Watcher } from "common/util/watcher";

import { actions } from "common/actions";

import rootLogger from "common/logger";
const logger = rootLogger.child({ name: "abort-task" });

import { getCurrentTasks } from "./as-task-persistent-state";

export default function(watcher: Watcher) {
  watcher.on(actions.abortTask, async (store, action) => {
    const { id } = action.payload;
    const ctx = getCurrentTasks()[id];
    if (ctx) {
      try {
        await ctx.tryAbort();
      } catch (e) {
        logger.warn(`Could not cancel task ${id}: ${e.stack}`);
      }
    }
  });
}
开发者ID:HorrerGames,项目名称:itch,代码行数:22,代码来源:abort-task.ts


示例3: function

import { Watcher } from "common/util/watcher";
import { actions } from "common/actions";
import fs from "fs";
import { dirname } from "path";

import rootLogger from "common/logger";
const logger = rootLogger.child({ name: "explore-cave" });

import * as explorer from "../../os/explorer";

import { withLogger, messages } from "common/butlerd";
const call = withLogger(logger);

export default function(watcher: Watcher) {
  watcher.on(actions.exploreCave, async (store, action) => {
    const { caveId } = action.payload;

    const { cave } = await call(messages.FetchCave, { caveId });
    const installFolder = cave.installInfo.installFolder;
    try {
      fs.accessSync(installFolder);
      explorer.open(installFolder);
    } catch (e) {
      explorer.open(dirname(installFolder));
    }
  });
}
开发者ID:HorrerGames,项目名称:itch,代码行数:27,代码来源:explore-cave.ts


示例4: function

import { Watcher } from "common/util/watcher";
import { actions } from "common/actions";

import rootLogger from "common/logger";
const logger = rootLogger.child({ name: "queue-cave-uninstall" });

import { promisedModal } from "../modals";

import asTask from "./as-task";
import { modalWidgets } from "renderer/components/modal-widgets/index";

import { performUninstall } from "../downloads/perform-uninstall";

import { withLogger, messages } from "common/butlerd";
const call = withLogger(logger);

export default function(watcher: Watcher) {
  watcher.on(actions.queueCaveUninstall, async (store, action) => {
    const { caveId } = action.payload;

    // TODO: figure if we really need that. asTask wants a gameId
    // but do we really need it? how used is asTask anyway?
    const { cave } = await call(messages.FetchCave, { caveId });

    await asTask({
      name: "uninstall",
      gameId: cave.game.id,
      store,
      work: async (ctx, logger) => {
        await performUninstall(logger, caveId);
        store.dispatch(actions.uninstallEnded({}));
开发者ID:HorrerGames,项目名称:itch,代码行数:31,代码来源:queue-cave-uninstall.ts


示例5: function

import { Watcher } from "common/util/watcher";
import { actions } from "common/actions";

import rootLogger, { Logger } from "common/logger";
const logger = rootLogger.child({ name: "queue-game" });

import asTask from "./as-task";

import { IStore } from "common/types/index";
import { Game, Upload, Build } from "common/butlerd/messages";

import { map, isEmpty } from "underscore";
import { modalWidgets } from "renderer/components/modal-widgets/index";

import { withLogger, messages } from "common/butlerd";
const call = withLogger(logger);

import { promisedModal } from "../modals";
import { makeInstallErrorModal } from "./make-install-error-modal";
import { makeUploadButton } from "main/reactors/make-upload-button";

export default function(watcher: Watcher) {
  watcher.on(actions.queueGame, async (store, action) => {
    const { game } = action.payload;
    const { caves } = await call(messages.FetchCavesByGameID, {
      gameId: game.id,
    });

    if (isEmpty(caves)) {
      logger.info(
        `No cave for ${game.title} (#${game.id}), attempting install`
开发者ID:HorrerGames,项目名称:itch,代码行数:31,代码来源:queue-game.ts


示例6: updateCommonsNow

import { Watcher } from "common/util/watcher";
import { IStore } from "common/types";

import { indexBy, isEmpty } from "underscore";
import groupIdBy from "common/helpers/group-id-by";

import { actions } from "common/actions";
import { throttle, isEqual } from "underscore";

import rootLogger from "common/logger";
import { messages, withLogger } from "common/butlerd";
const logger = rootLogger.child({ name: "commons" });
const call = withLogger(logger);

async function updateCommonsNow(store: IStore) {
  try {
    await updateCommonsNowThrows(store);
  } catch (e) {
    logger.warn(`While fetching commons: ${e.stack}`);
  }
}

async function updateCommonsNowThrows(store: IStore) {
  if (!store.getState().setup.done) {
    return;
  }

  const { caves, downloadKeys, installLocations } = await call(
    messages.FetchCommons,
    {}
  );
开发者ID:HorrerGames,项目名称:itch,代码行数:31,代码来源:commons.ts


示例7: resolve

import { resolve, join, basename } from "path";
import { app } from "electron";
import spawn from "../spawn";
import * as sf from "../sf";

import { MinimalContext } from "../../context";

import rootLogger, { devNull } from "common/logger";
const logger = rootLogger.child({ name: "shortcut" });

const appFolder = resolve(process.execPath, "..");
const rootFolder = resolve(appFolder, "..");
export const updateExePath = join(rootFolder, "Update.exe");
const exeName = basename(process.execPath);

export async function updateRun(
  ctx: MinimalContext,
  args: string[]
): Promise<void> {
  logger.info(`Update.exe located at = ${updateExePath}`);
  try {
    await spawn.assert({
      command: updateExePath,
      args,
      ctx,
      logger: devNull,
    });
  } catch (err) {
    logger.error(`Running Update failed with ${err.message}`);
  }
}
开发者ID:HorrerGames,项目名称:itch,代码行数:31,代码来源:shortcut.ts


示例8:

import { screen } from "electron";
import { createSelector } from "reselect";
import { format as formatUrl, UrlObject } from "url";
import * as path from "path";

import env from "common/env";

import { darkMineShaft } from "common/constants/colors";
import { app, BrowserWindow, BrowserWindowConstructorOptions } from "electron";
import config from "common/util/config";
import * as os from "../os";
import { debounce } from "underscore";

import rootLogger from "common/logger";
const logger = rootLogger.child({ name: "main-window" });

import { actions } from "common/actions";

type AppCommand = "browser-backward" | "browser-forward";

const BOUNDS_CONFIG_KEY = "main_window_bounds";
const MAXIMIZED_CONFIG_KEY = "main_window_maximized";

const macOs = os.platform() === "darwin";

import {
  IRootState,
  IStore,
  INativeWindowState,
  ItchWindowRole,
开发者ID:HorrerGames,项目名称:itch,代码行数:30,代码来源:main-window.ts


示例9: function

import { Watcher } from "common/util/watcher";

import urlParser from "url";

import rootLogger from "common/logger";
const logger = rootLogger.child({ name: "reactors/url" });

import urls from "common/constants/urls";

import { shell } from "electron";

import { actions } from "common/actions";
import { IStore } from "common/types";

import { filter } from "underscore";
import { call, messages } from "common/butlerd";
import { reportIssue } from "main/crash-reporter";
import { isItchioURL } from "common/util/url";

export default function(watcher: Watcher) {
  watcher.on(actions.processUrlArguments, async (store, action) => {
    const { args } = action.payload;
    for (const uri of args) {
      if (isItchioURL(uri)) {
        store.dispatch(actions.handleItchioURI({ uri }));
        break;
      }
    }
  });

  watcher.on(actions.openInExternalBrowser, async (store, action) => {
开发者ID:HorrerGames,项目名称:itch,代码行数:31,代码来源:url.ts


示例10: cancel

import { Client } from "butlerd";

import rootLogger from "common/logger";
import { messages } from "common/butlerd";
const logger = rootLogger.child({ name: "download-driver" });

export enum Phase {
  IDLE,
  STARTING,
  RUNNING,
  CANCELLING,
}

class State {
  private client: Client;
  private phase: Phase;

  constructor() {
    this.phase = Phase.IDLE;
  }

  registerClient(client: Client) {
    this.client = client;
    this.setPhase(Phase.RUNNING);
  }

  async cancel() {
    this.setPhase(Phase.CANCELLING);
    await this.client.call(messages.DownloadsDriveCancel, {});
    this.client = null;
  }
开发者ID:HorrerGames,项目名称:itch,代码行数:31,代码来源:driver-persistent-state.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript Logger.Logger类代码示例发布时间:2022-05-25
下一篇:
TypeScript HttpService.HttpService类代码示例发布时间: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