Skip to content

Instantly share code, notes, and snippets.

@jwulf
Last active February 29, 2020 19:15
Show Gist options
  • Select an option

  • Save jwulf/43e8b92ebf14e209542205c3f35af275 to your computer and use it in GitHub Desktop.

Select an option

Save jwulf/43e8b92ebf14e209542205c3f35af275 to your computer and use it in GitHub Desktop.
private createInterceptedGrpcClient(config: GrpcClientCtor) {
const grpcClient = new GrpcClient(config)
grpcClient.on(MiddlewareSignals.Log.Debug, this.debug)
grpcClient.on(MiddlewareSignals.Log.Info, this.info)
grpcClient.on(MiddlewareSignals.Log.Error, this.error)
grpcClient.on(MiddlewareSignals.Event.Error, this.emitError)
grpcClient.on(MiddlewareSignals.Event.Ready, this.emitReady)
return grpcClient
}
private info = (msg: any) => this.log.info(msg)
private debug = (msg: any) => this.log.debug(msg)
private error = (msg: any) => this.log.error(msg)
private emitError = () => this.grpcClient.emit('error')
private emitReady = () => this.grpcClient.emit('ready')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment