Conversation
sandy081
commented
Jan 12, 2023
- ILoggerService centrailised place for all loggers
- Provide options to display logger while creating/registering logger
- Listen to logger service and register log output channels accordingly
- Adopt this at all places where loggers are created
- Provide options to display logger while creating/registering logger - Listen to logger service and register log output channels accordingly - Adopt this at all places where loggers are created
| const isVisible = () => supportsTelemetry(productService, environmentService) && logService.getLevel() === LogLevel.Trace; | ||
| this.logger = this._register(loggerService.createLogger(telemetryLogResource, { id: telemetryLogChannelId, name: localize('telemetryLog', "Telemetry{0}", logSuffix), hidden: !isVisible() })); | ||
| this._register(logService.onDidChangeLogLevel(() => loggerService.setVisibility(telemetryLogResource, isVisible()))); | ||
|
|
There was a problem hiding this comment.
CC @lramos15 - You do not need to create output channel now. You can include all necessary info while creating the logger and system will create it whenever you want. For eg., here you can change the visibility of the logger and it will allow system to create/remove the channel.
| ) { | ||
| super(); | ||
| this.logger = this._register(loggerService.createLogger(environmentService.editSessionsLogResource, { name: 'editsessions' })); | ||
| this.logger = this._register(loggerService.createLogger(environmentService.editSessionsLogResource, { id: editSessionsLogId, name: localize('cloudChangesLog', "Cloud Changes") })); |
There was a problem hiding this comment.
@joyceerhl you do not need to create output channel now. You can include all necessary info while creating the logger and system will create it automatically.
| const logsPath = joinPath(environmentService.windowLogsPath, 'notebook.rendering.log'); | ||
| this._renderLogger = this._register(loggerService.createLogger(logsPath, { name: 'notebook.rendering' })); | ||
| registerLogChannel(logChannelId, nls.localize('renderChannelName', "Notebook rendering"), logsPath, fileService, logService); | ||
| this._renderLogger = this._register(loggerService.createLogger(logsPath, { id: logChannelId, name: nls.localize('renderChannelName', "Notebook rendering") })); |
| const promise = registerLogChannel(id, label, file, this._fileService, this._logService); | ||
| this._register(toDisposable(() => promise.cancel())); | ||
| } | ||
| } |
There was a problem hiding this comment.
@Tyriar you do not need to create output channel now. You can include all necessary info while creating or registering the logger and system will create it automatically.
| LogLevelChannelClient.setLevel(logChannel, this._logService.getLevel()); | ||
| const ptyHostLogResource = URI.file(join(this._environmentService.logsPath, `${TerminalLogConstants.FileName}.log`)); | ||
| this._loggerService.registerLoggerResource({ id: 'ptyHostLog', name: localize('ptyHost', "Pty Host"), resource: ptyHostLogResource }); | ||
| this._loggerService.registerLogger({ id: 'ptyHostLog', name: localize('ptyHost', "Pty Host"), resource: ptyHostLogResource }); |
There was a problem hiding this comment.
@Tyriar In your case you have to register the logger with the main logger service because your logger is created in a different process. Registering shall be sufficient for the system to create output channel for your logger.