本文整理汇总了TypeScript中vscode-chrome-debug-core.logger类的典型用法代码示例。如果您正苦于以下问题:TypeScript logger类的具体用法?TypeScript logger怎么用?TypeScript logger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了logger类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: attach
public attach(args: any): Promise<void> {
logger.log(`Attaching to Edge`);
return this._launchAdapter(args).then((attachArgs:any) =>{
return super.attach(attachArgs);
});
}
示例2: _launchAdapter
//private _launchAdapter(url?:string, port?:number, adapterExePath?:string ):Promise<any> {
private _launchAdapter(args?:any):Promise<any> {
let adapterExePath = args.runtimeExecutable;
if (!adapterExePath) {
adapterExePath = edgeUtils.getAdapterPath();
}
logger.log(`Launching adapter at: '${adapterExePath}', ${JSON.stringify(arguments) })`);
// Check exists
if (!fs.existsSync(adapterExePath)) {
if (utils.getPlatform() == utils.Platform.Windows) {
return utils.errP(`No Edge Diagnostics Adapter was found. Install the Edge Diagnostics Adapter (https://github.com/Microsoft/edge-diagnostics-adapter) and specify a valid 'adapterExecutable' path`);
} else {
return utils.errP(`Edge debugging is only supported on Windows 10.`);
}
}
let adapterArgs:string[] = [];
if (!args.port) {
args.port = 9222;
}
// We always tell the adpater what port to listen on so there's no shared info between the adapter and the extension
let portCmdArg = '--port=' + args.port;
adapterArgs.push(portCmdArg);
if(args.url){
let launchUrlArg = '--launch='+ args.url;
adapterArgs.push(launchUrlArg);
}
// The adapter might already be running if so don't spawn a new one
return utils.getURL(`http://127.0.0.1:${args.port}/json/version`).then((jsonResponse:any) => {
try {
const responseArray = JSON.parse(jsonResponse);
let targetBrowser:string = responseArray.Browser;
targetBrowser = targetBrowser.toLocaleLowerCase();
if(targetBrowser.indexOf('edge') > -1){
return Promise.resolve(args);
}
return utils.errP(`Sever for ${targetBrowser} already listening on :9222`);
} catch (ex) {
return utils.errP(`Sever already listening on :9222 returned ${ex}`);
}
}, error => {
logger.log(`spawn('${adapterExePath}', ${JSON.stringify(adapterArgs) })`);
this._adapterProc = childProcess.execFile(adapterExePath, adapterArgs, (err) => {
logger.error(`Adapter error: ${err}`);
this.terminateSession(err);
}, (data) => {
logger.log(`Adapter output: ${data}`);
});
return Promise.resolve(args);
});
}
示例3:
}, error => {
logger.log(`spawn('${adapterExePath}', ${JSON.stringify(adapterArgs) })`);
this._adapterProc = childProcess.execFile(adapterExePath, adapterArgs, (err) => {
logger.error(`Adapter error: ${err}`);
this.terminateSession(err);
}, (data) => {
logger.log(`Adapter output: ${data}`);
});
return Promise.resolve(args);
});
示例4: launch
public launch(args: any): Promise<void> {
logger.log(`Launching Edge`);
let launchUrl: string;
if (args.file) {
launchUrl = 'file:///' + path.resolve(args.cwd, args.file);
} else if (args.url) {
launchUrl = args.url;
}
return this._launchAdapter(args).then((attachArgs:any) =>{
return super.attach(attachArgs);
});
}
示例5: require
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import {ChromeDebugSession, logger} from 'vscode-chrome-debug-core';
import * as path from 'path';
// Start a ChromeDebugSession configured to only match 'page' targets, which are Chrome tabs
ChromeDebugSession.run(ChromeDebugSession.getSession(
{
targetFilter: target => target && (!target.type || target.type === 'page'),
logFileDirectory: path.resolve(__dirname, '../../')
}));
/* tslint:disable:no-var-requires */
logger.log('debugger-for-chrome: ' + require('../../package.json').version);
示例6: require
import * as os from 'os';
import { targetFilter } from './utils';
import { ChromeDebugAdapter } from './chromeDebugAdapter';
const EXTENSION_NAME = 'debugger-for-chrome';
// Start a ChromeDebugSession configured to only match 'page' targets, which are Chrome tabs.
// Cast because DebugSession is declared twice - in this repo's vscode-debugadapter, and that of -core... TODO
ChromeDebugSession.run(ChromeDebugSession.getSession(
{
adapter: ChromeDebugAdapter,
extensionName: EXTENSION_NAME,
logFilePath: path.resolve(os.tmpdir(), 'vscode-chrome-debug.txt'),
targetFilter,
pathTransformer: UrlPathTransformer,
sourceMapTransformer: BaseSourceMapTransformer,
}));
/* tslint:disable:no-var-requires */
const debugAdapterVersion = require('../../package.json').version;
logger.log(EXTENSION_NAME + ': ' + debugAdapterVersion);
/* __GDPR__FRAGMENT__
"DebugCommonProperties" : {
"Versions.DebugAdapter" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
telemetry.telemetry.addCustomGlobalProperty({'Versions.DebugAdapter': debugAdapterVersion});