@@ -53,13 +53,13 @@ import CommunicationProtocolEnum from '../../enum/CommunicationProtocol.enum';
53
53
import { DaprClientOptions } from '../../types/DaprClientOptions' ;
54
54
import { Settings } from '../../utils/Settings.util' ;
55
55
import { Logger } from '../../logger/Logger' ;
56
+ import { LoggerOptions } from "../../types/logger/LoggerOptions" ;
56
57
57
58
export default class DaprClient {
58
59
readonly daprHost : string ;
59
60
readonly daprPort : string ;
60
61
readonly options : DaprClientOptions ;
61
62
readonly communicationProtocol : CommunicationProtocolEnum ;
62
- readonly logger : Logger ;
63
63
64
64
readonly daprClient : IClient ;
65
65
readonly pubsub : IClientPubSub ;
@@ -73,8 +73,7 @@ export default class DaprClient {
73
73
readonly configuration : IClientConfiguration ;
74
74
readonly actor : IClientActorBuilder ;
75
75
76
- private readonly LOG_COMPONENT : string = "DaprClient" ;
77
- private readonly LOG_AREA : string = "DaprClient" ;
76
+ private readonly logger : Logger ;
78
77
79
78
constructor (
80
79
daprHost ?: string
@@ -88,7 +87,7 @@ export default class DaprClient {
88
87
this . daprPort = daprPort ?? Settings . getDefaultPort ( communicationProtocol ) ;
89
88
this . communicationProtocol = communicationProtocol ;
90
89
this . options = options ;
91
- this . logger = new Logger ( this . options . logger ) ;
90
+ this . logger = new Logger ( "DaprClient" , "DaprClient" , this . options . logger ) ;
92
91
93
92
// Validation on port
94
93
if ( ! / ^ [ 0 - 9 ] + $ / . test ( this . daprPort ) ) {
@@ -98,11 +97,11 @@ export default class DaprClient {
98
97
// Builder
99
98
switch ( communicationProtocol ) {
100
99
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 ) ;
102
101
this . daprClient = client ;
103
102
104
103
this . state = new GRPCClientState ( client ) ;
105
- this . pubsub = new GRPCClientPubSub ( client , this . logger ) ;
104
+ this . pubsub = new GRPCClientPubSub ( client ) ;
106
105
this . binding = new GRPCClientBinding ( client ) ;
107
106
this . invoker = new GRPCClientInvoker ( client ) ;
108
107
this . secret = new GRPCClientSecret ( client ) ;
@@ -115,11 +114,11 @@ export default class DaprClient {
115
114
}
116
115
case CommunicationProtocolEnum . HTTP :
117
116
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 ) ;
119
118
this . daprClient = client ;
120
119
121
120
this . state = new HTTPClientState ( client ) ;
122
- this . pubsub = new HTTPClientPubSub ( client , this . logger ) ;
121
+ this . pubsub = new HTTPClientPubSub ( client ) ;
123
122
this . binding = new HTTPClientBinding ( client ) ;
124
123
this . invoker = new HTTPClientInvoker ( client ) ;
125
124
this . secret = new HTTPClientSecret ( client ) ;
@@ -148,9 +147,9 @@ export default class DaprClient {
148
147
let isHealthyRetryCount = 0 ;
149
148
const isHealthyMaxRetryCount = 60 ; // 1s startup delay and we try max for 60s
150
149
151
- this . logger . info ( this . LOG_COMPONENT , this . LOG_AREA , `Awaiting Sidecar to be Started` ) ;
150
+ this . logger . info ( `Awaiting Sidecar to be Started` ) ;
152
151
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 } )` ) ;
154
153
await NodeJSUtils . sleep ( Settings . getDaprSidecarPollingDelayMs ( ) ) ;
155
154
156
155
// Implement API call manually as we need to enable calling without initialization
@@ -177,7 +176,7 @@ export default class DaprClient {
177
176
await this . awaitSidecarStarted ( ) ;
178
177
await this . daprClient . start ( ) ;
179
178
await this . daprClient . setIsInitialized ( true ) ;
180
- this . logger . info ( this . LOG_COMPONENT , this . LOG_AREA , "Sidecar Started" ) ;
179
+ this . logger . info ( "Sidecar Started" ) ;
181
180
}
182
181
183
182
getDaprClient ( ) : IClient {
0 commit comments