mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-31 15:07:47 +00:00
Fix backend logger bindings
This commit is contained in:
parent
ce2f1c227a
commit
b97af32bb8
@ -84,8 +84,9 @@ import { PlotterBackendContribution } from './plotter/plotter-backend-contributi
|
|||||||
import { ArduinoLocalizationContribution } from './arduino-localization-contribution';
|
import { ArduinoLocalizationContribution } from './arduino-localization-contribution';
|
||||||
import { LocalizationContribution } from '@theia/core/lib/node/i18n/localization-contribution';
|
import { LocalizationContribution } from '@theia/core/lib/node/i18n/localization-contribution';
|
||||||
import { MonitorManagerProxyImpl } from './monitor-manager-proxy-impl';
|
import { MonitorManagerProxyImpl } from './monitor-manager-proxy-impl';
|
||||||
import { MonitorManager } from './monitor-manager';
|
import { MonitorManager, MonitorManagerName } from './monitor-manager';
|
||||||
import { MonitorManagerProxy, MonitorManagerProxyClient, MonitorManagerProxyPath } from '../common/protocol/monitor-service';
|
import { MonitorManagerProxy, MonitorManagerProxyClient, MonitorManagerProxyPath } from '../common/protocol/monitor-service';
|
||||||
|
import { MonitorServiceName } from './monitor-service';
|
||||||
|
|
||||||
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
||||||
bind(BackendApplication).toSelf().inSingletonScope();
|
bind(BackendApplication).toSelf().inSingletonScope();
|
||||||
@ -302,6 +303,23 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|||||||
.inSingletonScope()
|
.inSingletonScope()
|
||||||
.whenTargetNamed('config');
|
.whenTargetNamed('config');
|
||||||
|
|
||||||
|
// Logger for the monitor manager and its services
|
||||||
|
bind(ILogger)
|
||||||
|
.toDynamicValue((ctx) => {
|
||||||
|
const parentLogger = ctx.container.get<ILogger>(ILogger);
|
||||||
|
return parentLogger.child(MonitorManagerName);
|
||||||
|
})
|
||||||
|
.inSingletonScope()
|
||||||
|
.whenTargetNamed(MonitorManagerName);
|
||||||
|
|
||||||
|
bind(ILogger)
|
||||||
|
.toDynamicValue((ctx) => {
|
||||||
|
const parentLogger = ctx.container.get<ILogger>(ILogger);
|
||||||
|
return parentLogger.child(MonitorServiceName);
|
||||||
|
})
|
||||||
|
.inSingletonScope()
|
||||||
|
.whenTargetNamed(MonitorServiceName);
|
||||||
|
|
||||||
bind(DefaultGitInit).toSelf();
|
bind(DefaultGitInit).toSelf();
|
||||||
rebind(GitInit).toService(DefaultGitInit);
|
rebind(GitInit).toService(DefaultGitInit);
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { ILogger } from "@theia/core";
|
import { inject, injectable } from "@theia/core/shared/inversify";
|
||||||
import { inject, injectable, named } from "@theia/core/shared/inversify";
|
|
||||||
import { MonitorManagerProxy, MonitorManagerProxyClient, MonitorSettings, Status } from "../common/protocol";
|
import { MonitorManagerProxy, MonitorManagerProxyClient, MonitorSettings, Status } from "../common/protocol";
|
||||||
import { Board, Port } from "../common/protocol";
|
import { Board, Port } from "../common/protocol";
|
||||||
import { MonitorManager } from "./monitor-manager";
|
import { MonitorManager } from "./monitor-manager";
|
||||||
@ -9,10 +8,6 @@ export class MonitorManagerProxyImpl implements MonitorManagerProxy {
|
|||||||
protected client: MonitorManagerProxyClient;
|
protected client: MonitorManagerProxyClient;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject(ILogger)
|
|
||||||
@named("monitor-manager-proxy")
|
|
||||||
protected readonly logger: ILogger,
|
|
||||||
|
|
||||||
@inject(MonitorManager)
|
@inject(MonitorManager)
|
||||||
protected readonly manager: MonitorManager,
|
protected readonly manager: MonitorManager,
|
||||||
) {
|
) {
|
||||||
|
@ -6,6 +6,8 @@ import { MonitorService } from "./monitor-service";
|
|||||||
|
|
||||||
type MonitorID = string;
|
type MonitorID = string;
|
||||||
|
|
||||||
|
export const MonitorManagerName = 'monitor-manager';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class MonitorManager extends CoreClientAware {
|
export class MonitorManager extends CoreClientAware {
|
||||||
// Map of monitor services that manage the running pluggable monitors.
|
// Map of monitor services that manage the running pluggable monitors.
|
||||||
@ -16,7 +18,7 @@ export class MonitorManager extends CoreClientAware {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject(ILogger)
|
@inject(ILogger)
|
||||||
@named('monitor-manager')
|
@named(MonitorManagerName)
|
||||||
protected readonly logger: ILogger,
|
protected readonly logger: ILogger,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
@ -8,6 +8,8 @@ import { WebSocketProvider } from "./web-socket/web-socket-provider";
|
|||||||
import { Port as gRPCPort } from 'arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb'
|
import { Port as gRPCPort } from 'arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb'
|
||||||
import WebSocketProviderImpl from "./web-socket/web-socket-provider-impl";
|
import WebSocketProviderImpl from "./web-socket/web-socket-provider-impl";
|
||||||
|
|
||||||
|
export const MonitorServiceName = 'monitor-service';
|
||||||
|
|
||||||
export class MonitorService extends CoreClientAware implements Disposable {
|
export class MonitorService extends CoreClientAware implements Disposable {
|
||||||
// Bidirectional gRPC stream used to receive and send data from the running
|
// Bidirectional gRPC stream used to receive and send data from the running
|
||||||
// pluggable monitor managed by the Arduino CLI.
|
// pluggable monitor managed by the Arduino CLI.
|
||||||
@ -39,7 +41,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject(ILogger)
|
@inject(ILogger)
|
||||||
@named("monitor-service")
|
@named(MonitorServiceName)
|
||||||
protected readonly logger: ILogger,
|
protected readonly logger: ILogger,
|
||||||
|
|
||||||
private readonly board: Board,
|
private readonly board: Board,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user