-
Notifications
You must be signed in to change notification settings - Fork 27.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
137 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { IChannel, eventToCall, eventFromCall } from 'vs/base/parts/ipc/common/ipc'; | ||
import { TPromise } from 'vs/base/common/winjs.base'; | ||
import { LogLevel, ILogService } from 'vs/platform/log/common/log'; | ||
import Event, { buffer } from 'vs/base/common/event'; | ||
|
||
export interface ILogLevelManagementChannel extends IChannel { | ||
call(command: 'event:onDidChangeLogLevel'): TPromise<LogLevel>; | ||
call(command: 'setLogLevel', logLevel: LogLevel): TPromise<void>; | ||
} | ||
|
||
export class LogLevelChannel implements ILogLevelManagementChannel { | ||
|
||
onDidChangeLogLevel: Event<LogLevel>; | ||
|
||
constructor(private service: ILogService) { | ||
this.onDidChangeLogLevel = buffer(service.onDidChangeLogLevel, true); | ||
} | ||
|
||
call(command: string, arg?: any): TPromise<any> { | ||
switch (command) { | ||
case 'event:onDidChangeLogLevel': return eventToCall(this.onDidChangeLogLevel); | ||
case 'setLogLevel': this.service.setLevel(arg); return TPromise.as(null); | ||
} | ||
return undefined; | ||
} | ||
} | ||
|
||
export class LogLevelChannelClient { | ||
|
||
constructor(private channel: ILogLevelManagementChannel) { } | ||
|
||
private _onDidChangeLogLevel = eventFromCall<LogLevel>(this.channel, 'event:onDidChangeLogLevel'); | ||
get onDidChangeLogLevel(): Event<LogLevel> { return this._onDidChangeLogLevel; } | ||
|
||
setLogLevel(level: LogLevel): TPromise<void> { | ||
return this.channel.call('setLogLevel', level); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/vs/workbench/api/electron-browser/mainThreadLogService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
'use strict'; | ||
|
||
import { ExtHostContext, IExtHostContext } from '../node/extHost.protocol'; | ||
import { extHostCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers'; | ||
import { ILogService } from 'vs/platform/log/common/log'; | ||
import { Disposable } from 'vs/base/common/lifecycle'; | ||
|
||
@extHostCustomer | ||
export class MainThreadLogLevelManagementChannel extends Disposable { | ||
|
||
constructor( | ||
extHostContext: IExtHostContext, | ||
@ILogService logService: ILogService, | ||
) { | ||
super(); | ||
this._register(logService.onDidChangeLogLevel(level => extHostContext.getProxy(ExtHostContext.ExtHostLogService).$setLogLevel(level))); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters