mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)
* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 * update distro * fix layering * update distro * fix tests
This commit is contained in:
@@ -173,7 +173,7 @@ export class FileLoggerService extends Disposable implements ILoggerService {
|
||||
getLogger(resource: URI): ILogger {
|
||||
let logger = this.loggers.get(resource.toString());
|
||||
if (!logger) {
|
||||
logger = new BufferLogService, this.logService.getLevel();
|
||||
logger = new BufferLogService(this.logService.getLevel());
|
||||
this.loggers.set(resource.toString(), logger);
|
||||
whenProviderRegistered(resource, this.fileService).then(() => (<BufferLogService>logger).logger = this.instantiationService.createInstance(FileLogService, basename(resource), resource, this.logService.getLevel()));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { LoggerChannelClient } from 'vs/platform/log/common/logIpc';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
|
||||
export const ILogService = createServiceDecorator<ILogService>('logService');
|
||||
export const ILoggerService = createServiceDecorator<ILoggerService>('loggerService');
|
||||
@@ -223,40 +224,48 @@ export class ConsoleLogInMainService extends AbstractLogService implements ILogS
|
||||
|
||||
trace(message: string, ...args: any[]): void {
|
||||
if (this.getLevel() <= LogLevel.Trace) {
|
||||
this.client.consoleLog('trace', [message, ...args]);
|
||||
this.client.consoleLog('trace', [this.extractMessage(message), ...args]);
|
||||
}
|
||||
}
|
||||
|
||||
debug(message: string, ...args: any[]): void {
|
||||
if (this.getLevel() <= LogLevel.Debug) {
|
||||
this.client.consoleLog('debug', [message, ...args]);
|
||||
this.client.consoleLog('debug', [this.extractMessage(message), ...args]);
|
||||
}
|
||||
}
|
||||
|
||||
info(message: string, ...args: any[]): void {
|
||||
if (this.getLevel() <= LogLevel.Info) {
|
||||
this.client.consoleLog('info', [message, ...args]);
|
||||
this.client.consoleLog('info', [this.extractMessage(message), ...args]);
|
||||
}
|
||||
}
|
||||
|
||||
warn(message: string | Error, ...args: any[]): void {
|
||||
if (this.getLevel() <= LogLevel.Warning) {
|
||||
this.client.consoleLog('warn', [message, ...args]);
|
||||
this.client.consoleLog('warn', [this.extractMessage(message), ...args]);
|
||||
}
|
||||
}
|
||||
|
||||
error(message: string, ...args: any[]): void {
|
||||
error(message: string | Error, ...args: any[]): void {
|
||||
if (this.getLevel() <= LogLevel.Error) {
|
||||
this.client.consoleLog('error', [message, ...args]);
|
||||
this.client.consoleLog('error', [this.extractMessage(message), ...args]);
|
||||
}
|
||||
}
|
||||
|
||||
critical(message: string, ...args: any[]): void {
|
||||
critical(message: string | Error, ...args: any[]): void {
|
||||
if (this.getLevel() <= LogLevel.Critical) {
|
||||
this.client.consoleLog('critical', [message, ...args]);
|
||||
this.client.consoleLog('critical', [this.extractMessage(message), ...args]);
|
||||
}
|
||||
}
|
||||
|
||||
private extractMessage(msg: string | Error): string {
|
||||
if (typeof msg === 'string') {
|
||||
return msg;
|
||||
}
|
||||
|
||||
return toErrorMessage(msg, this.getLevel() <= LogLevel.Trace);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
// noop
|
||||
}
|
||||
|
||||
@@ -77,6 +77,8 @@ export class FollowerLogService extends DelegatedLogService implements ILogServi
|
||||
}
|
||||
|
||||
setLevel(level: LogLevel): void {
|
||||
super.setLevel(level);
|
||||
|
||||
this.master.setLevel(level);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user