mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-31 12:49:41 +01:00
Log: Enhancements and cleaup (#171325)
- Make logger service primary source for log level - Automatically register output channels for loggers from anywhere - Use logger channels on remote processes (server, pty) - clean up loggers and log service
This commit is contained in:
committed by
GitHub
parent
a2bdb408ba
commit
05d59b893e
@@ -39,7 +39,7 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks';
|
||||
import { NativeLanguagePackService } from 'vs/platform/languagePacks/node/languagePacks';
|
||||
import { ConsoleLogger, getLogLevel, ILogger, ILogService, LogLevel, MultiplexLogService } from 'vs/platform/log/common/log';
|
||||
import { ConsoleLogger, getLogLevel, ILogger, ILogService, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { SpdLogLogger } from 'vs/platform/log/node/spdlogLog';
|
||||
import { FilePolicyService } from 'vs/platform/policy/common/filePolicyService';
|
||||
import { IPolicyService, NullPolicyService } from 'vs/platform/policy/common/policy';
|
||||
@@ -62,6 +62,7 @@ import { IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG } from 'vs/platfor
|
||||
import { UserDataProfilesService } from 'vs/platform/userDataProfile/node/userDataProfile';
|
||||
import { resolveMachineId } from 'vs/platform/telemetry/node/telemetryUtils';
|
||||
import { ExtensionsProfileScannerService } from 'vs/platform/extensionManagement/node/extensionsProfileScannerService';
|
||||
import { LogService } from 'vs/platform/log/common/logService';
|
||||
|
||||
class CliMain extends Disposable {
|
||||
|
||||
@@ -126,13 +127,13 @@ class CliMain extends Disposable {
|
||||
|
||||
// Log
|
||||
const logLevel = getLogLevel(environmentService);
|
||||
const loggers: ILogger[] = [];
|
||||
loggers.push(new SpdLogLogger('cli', join(environmentService.logsPath, 'cli.log'), true, false, logLevel));
|
||||
const spdLogLogger = new SpdLogLogger('cli', join(environmentService.logsPath, 'cli.log'), true, false, logLevel);
|
||||
const otherLoggers: ILogger[] = [];
|
||||
if (logLevel === LogLevel.Trace) {
|
||||
loggers.push(new ConsoleLogger(logLevel));
|
||||
otherLoggers.push(new ConsoleLogger(logLevel));
|
||||
}
|
||||
|
||||
const logService = this._register(new MultiplexLogService(loggers));
|
||||
const logService = this._register(new LogService(spdLogLogger, otherLoggers));
|
||||
services.set(ILogService, logService);
|
||||
|
||||
// Files
|
||||
|
||||
Reference in New Issue
Block a user