diff --git a/packages/logging-service/src/app.module.ts b/packages/logging-service/src/app.module.ts index 6b8bf719..9b429371 100644 --- a/packages/logging-service/src/app.module.ts +++ b/packages/logging-service/src/app.module.ts @@ -3,7 +3,8 @@ import { AppController } from './app.controller'; import { AppService } from './app.service'; import { LoggingModule } from './modules/logging/logging.module'; import { ClientsModule, Transport } from '@nestjs/microservices'; -import * as path from 'path'; +import { JUNO_LOGGING_PACKAGE_NAME } from 'juno-proto/dist/gen/logging'; +import { LoggingProtoFile } from 'juno-proto'; @Module({ imports: [ @@ -13,13 +14,8 @@ import * as path from 'path'; name: 'LOGGING_SERVICE', transport: Transport.GRPC, options: { - package: 'error_logging', - protoPath: path.join( - __dirname, - '../../', - 'juno-proto/dist/definitions', - 'error_logging.proto', - ), + package: JUNO_LOGGING_PACKAGE_NAME, + protoPath: [LoggingProtoFile], }, }, ]), diff --git a/packages/proto/definitions/error_logging.proto b/packages/proto/definitions/error_logging.proto deleted file mode 100644 index 47a1637d..00000000 --- a/packages/proto/definitions/error_logging.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -package logging; - -service LoggingService { - rpc recordError (ErrorLogRequest) returns (ErrorLogResponse) {} -} - -// The request message containing the error message. -message ErrorLogRequest { - string message = 1; -} - -// TODO: to be defined later -message ErrorLogResponse {} \ No newline at end of file diff --git a/packages/proto/definitions/logging.proto b/packages/proto/definitions/logging.proto index 7375727c..ff521ca5 100644 --- a/packages/proto/definitions/logging.proto +++ b/packages/proto/definitions/logging.proto @@ -4,10 +4,18 @@ package juno.logging; service LoggingService { rpc recordInfo(RecordInfoRequest) returns (RecordInfoResponse); + rpc recordError (ErrorLogRequest) returns (ErrorLogResponse) {} } message RecordInfoRequest { string message = 1; } -message RecordInfoResponse {} \ No newline at end of file +message RecordInfoResponse {} + +message ErrorLogRequest { + string message = 1; +} + +// TODO: to be defined later +message ErrorLogResponse {} diff --git a/packages/proto/src/gen/logging.ts b/packages/proto/src/gen/logging.ts index 3d140449..f6c26767 100644 --- a/packages/proto/src/gen/logging.ts +++ b/packages/proto/src/gen/logging.ts @@ -10,10 +10,19 @@ export interface RecordInfoRequest { export interface RecordInfoResponse {} +export interface ErrorLogRequest { + message: string; +} + +/** TODO: to be defined later */ +export interface ErrorLogResponse {} + export const JUNO_LOGGING_PACKAGE_NAME = 'juno.logging'; export interface LoggingServiceClient { recordInfo(request: RecordInfoRequest): Observable; + + recordError(request: ErrorLogRequest): Observable; } export interface LoggingServiceController { @@ -23,11 +32,18 @@ export interface LoggingServiceController { | Promise | Observable | RecordInfoResponse; + + recordError( + request: ErrorLogRequest, + ): + | Promise + | Observable + | ErrorLogResponse; } export function LoggingServiceControllerMethods() { return function (constructor: Function) { - const grpcMethods: string[] = ['recordInfo']; + const grpcMethods: string[] = ['recordInfo', 'recordError']; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor( constructor.prototype,