@@ -53,13 +53,13 @@ import CommunicationProtocolEnum from '../../enum/CommunicationProtocol.enum';
5353import { DaprClientOptions } from '../../types/DaprClientOptions' ;
5454import { Settings } from '../../utils/Settings.util' ;
5555import { Logger } from '../../logger/Logger' ;
56+ import { LoggerOptions } from "../../types/logger/LoggerOptions" ;
5657
5758export default class DaprClient {
5859 readonly daprHost : string ;
5960 readonly daprPort : string ;
6061 readonly options : DaprClientOptions ;
6162 readonly communicationProtocol : CommunicationProtocolEnum ;
62- readonly logger : Logger ;
6363
6464 readonly daprClient : IClient ;
6565 readonly pubsub : IClientPubSub ;
@@ -73,8 +73,7 @@ export default class DaprClient {
7373 readonly configuration : IClientConfiguration ;
7474 readonly actor : IClientActorBuilder ;
7575
76- private readonly LOG_COMPONENT : string = "DaprClient" ;
77- private readonly LOG_AREA : string = "DaprClient" ;
76+ private readonly logger : Logger ;
7877
7978 constructor (
8079 daprHost ?: string
@@ -88,7 +87,7 @@ export default class DaprClient {
8887 this . daprPort = daprPort ?? Settings . getDefaultPort ( communicationProtocol ) ;
8988 this . communicationProtocol = communicationProtocol ;
9089 this . options = options ;
91- this . logger = new Logger ( this . options . logger ) ;
90+ this . logger = new Logger ( "DaprClient" , "DaprClient" , this . options . logger ) ;
9291
9392 // Validation on port
9493 if ( ! / ^ [ 0 - 9 ] + $ / . test ( this . daprPort ) ) {
@@ -98,11 +97,11 @@ export default class DaprClient {
9897 // Builder
9998 switch ( communicationProtocol ) {
10099 case CommunicationProtocolEnum . GRPC : {
101- const client = new GRPCClient ( this . daprHost , this . daprPort , this . options , this . logger ) ;
100+ const client = new GRPCClient ( this . daprHost , this . daprPort , this . options ) ;
102101 this . daprClient = client ;
103102
104103 this . state = new GRPCClientState ( client ) ;
105- this . pubsub = new GRPCClientPubSub ( client , this . logger ) ;
104+ this . pubsub = new GRPCClientPubSub ( client ) ;
106105 this . binding = new GRPCClientBinding ( client ) ;
107106 this . invoker = new GRPCClientInvoker ( client ) ;
108107 this . secret = new GRPCClientSecret ( client ) ;
@@ -115,11 +114,11 @@ export default class DaprClient {
115114 }
116115 case CommunicationProtocolEnum . HTTP :
117116 default : {
118- const client = new HTTPClient ( this . daprHost , this . daprPort , this . options , this . logger ) ;
117+ const client = new HTTPClient ( this . daprHost , this . daprPort , this . options ) ;
119118 this . daprClient = client ;
120119
121120 this . state = new HTTPClientState ( client ) ;
122- this . pubsub = new HTTPClientPubSub ( client , this . logger ) ;
121+ this . pubsub = new HTTPClientPubSub ( client ) ;
123122 this . binding = new HTTPClientBinding ( client ) ;
124123 this . invoker = new HTTPClientInvoker ( client ) ;
125124 this . secret = new HTTPClientSecret ( client ) ;
@@ -148,9 +147,9 @@ export default class DaprClient {
148147 let isHealthyRetryCount = 0 ;
149148 const isHealthyMaxRetryCount = 60 ; // 1s startup delay and we try max for 60s
150149
151- this . logger . info ( this . LOG_COMPONENT , this . LOG_AREA , `Awaiting Sidecar to be Started` ) ;
150+ this . logger . info ( `Awaiting Sidecar to be Started` ) ;
152151 while ( ! isHealthy ) {
153- this . logger . verbose ( this . LOG_COMPONENT , this . LOG_AREA , `Waiting for the Dapr Sidecar to start, retry count: (#${ isHealthyRetryCount } )` ) ;
152+ this . logger . verbose ( `Waiting for the Dapr Sidecar to start, retry count: (#${ isHealthyRetryCount } )` ) ;
154153 await NodeJSUtils . sleep ( Settings . getDaprSidecarPollingDelayMs ( ) ) ;
155154
156155 // Implement API call manually as we need to enable calling without initialization
@@ -177,7 +176,7 @@ export default class DaprClient {
177176 await this . awaitSidecarStarted ( ) ;
178177 await this . daprClient . start ( ) ;
179178 await this . daprClient . setIsInitialized ( true ) ;
180- this . logger . info ( this . LOG_COMPONENT , this . LOG_AREA , "Sidecar Started" ) ;
179+ this . logger . info ( "Sidecar Started" ) ;
181180 }
182181
183182 getDaprClient ( ) : IClient {
0 commit comments