本文整理匯總了TypeScript中main/logger.mainLogger.child方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript mainLogger.child方法的具體用法?TypeScript mainLogger.child怎麽用?TypeScript mainLogger.child使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類main/logger.mainLogger
的用法示例。
在下文中一共展示了mainLogger.child方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
import { actions } from "common/actions";
import urls from "common/constants/urls";
import { Store } from "common/types";
import { isItchioURL } from "common/util/url";
import { Watcher } from "common/util/watcher";
import { shell } from "electron";
import { mainLogger } from "main/logger";
import { modals } from "common/modals";
import urlParser from "url";
import querystring from "querystring";
import { doAsync } from "renderer/helpers/doAsync";
import { queueInstall } from "main/reactors/tasks/queue-game";
import { mcall } from "main/butlerd/mcall";
import { messages } from "common/butlerd";
const logger = mainLogger.child(__filename);
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) => {
const uri = action.payload.url;
shell.openExternal(uri);
示例2:
import childProcess from "child_process";
import { formatExitCode } from "common/format/exit-code";
import { Logger } from "common/logger";
import { ItchPromise } from "common/util/itch-promise";
import { mainLogger } from "main/logger";
import split2 from "split2";
import stream from "stream";
import { MinimalContext } from "main/context";
const spawnLogger = mainLogger.child(__filename);
interface SpawnOpts {
/** Context this should run in */
ctx: MinimalContext;
/** Command to spawn */
command: string;
/** Arguments */
args: string[];
/** Defaults to eol for the current platform ("\r\n" or "\n") */
split?: string;
/** Called when the process has been started and we're ready to write to stdin */
onStdinReady?: (stdin: stream.Writable) => void;
/** If set, called on each line of stdout */
onToken?: (token: string) => void;
/** If set, called on each line of stderr */