Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit 02bcf41

Browse files
committed
Add logger to ZBClient
1 parent 7cac2ef commit 02bcf41

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/zb/ZBClient.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as ZB from '../lib/interfaces'
1010
import { OAuthProvider } from '../lib/OAuthProvider'
1111
// tslint:disable-next-line: no-duplicate-imports
1212
import { Utils } from '../lib/utils'
13+
import { ZBLogger } from '../lib/ZBLogger'
1314
import { ZBWorker } from './ZBWorker'
1415

1516
const DEFAULT_GATEWAY_PORT = '26500'
@@ -34,6 +35,7 @@ export class ZBClient {
3435
private maxRetries: number = 50
3536
private maxRetryTimeout: number = 5000
3637
private loglevel: ZB.Loglevel
38+
private logger: ZBLogger
3739
private oAuth?: OAuthProvider
3840
private useTLS: boolean
3941

@@ -48,7 +50,10 @@ export class ZBClient {
4850
(process.env.ZB_NODE_LOG_LEVEL as ZB.Loglevel) ||
4951
options.loglevel ||
5052
'INFO'
51-
53+
this.logger = new ZBLogger({
54+
loglevel: this.loglevel,
55+
taskType: 'ZBClient',
56+
})
5257
const includesProtocol = gatewayAddress.includes('://')
5358
if (!includesProtocol) {
5459
gatewayAddress = `grpc://${gatewayAddress}`
@@ -62,7 +67,8 @@ export class ZBClient {
6267
this.oAuth = options.oAuth
6368
? new OAuthProvider(options.oAuth)
6469
: undefined
65-
this.useTLS = options.useTLS !== false && !options.oAuth
70+
this.useTLS = options.useTLS === true || !!options.oAuth
71+
this.logger.info(`Use TLS: ${this.useTLS}`)
6672

6773
this.gRPCClient = new GRPCClient({
6874
host: this.gatewayAddress,

0 commit comments

Comments
 (0)