From 4ee7de37740eb704273eb1498e3ecb9c2984ce72 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Sun, 7 Feb 2021 16:53:32 +0000 Subject: [PATCH] cleaning logger types --- src/logger.ts | 2 -- src/util/WsStore.ts | 6 +++--- src/websocket-client.ts | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/logger.ts b/src/logger.ts index 4c5e682..0f5f29e 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,7 +1,5 @@ export type LogParams = null | any; -export type Logger = typeof DefaultLogger; - export const DefaultLogger = { silly: (...params: LogParams): void => { console.log(params); diff --git a/src/util/WsStore.ts b/src/util/WsStore.ts index 8937191..37e2f96 100644 --- a/src/util/WsStore.ts +++ b/src/util/WsStore.ts @@ -1,5 +1,5 @@ import { WsConnectionState } from '../websocket-client'; -import { DefaultLogger, Logger } from '../logger'; +import { DefaultLogger } from '../logger'; import WebSocket from 'isomorphic-ws'; @@ -20,9 +20,9 @@ export default class WsStore { private wsState: { [key: string]: WsStoredState; } - private logger: Logger; + private logger: typeof DefaultLogger; - constructor(logger: Logger) { + constructor(logger: typeof DefaultLogger) { this.logger = logger || DefaultLogger; this.wsState = {}; } diff --git a/src/websocket-client.ts b/src/websocket-client.ts index 92038f7..983e045 100644 --- a/src/websocket-client.ts +++ b/src/websocket-client.ts @@ -1,7 +1,7 @@ import { EventEmitter } from 'events'; import { InverseClient } from './inverse-client'; import { LinearClient } from './linear-client'; -import { DefaultLogger, Logger } from './logger'; +import { DefaultLogger } from './logger'; import { signMessage, serializeParams, isWsPong } from './util/requestUtils'; import WebSocket from 'isomorphic-ws'; @@ -76,12 +76,12 @@ const getLinearWsKeyForTopic = (topic: string) => { } export class WebsocketClient extends EventEmitter { - private logger: Logger; + private logger: typeof DefaultLogger; private restClient: InverseClient | LinearClient; private options: WebsocketClientOptions; private wsStore: WsStore; - constructor(options: WSClientConfigurableOptions, logger?: Logger) { + constructor(options: WSClientConfigurableOptions, logger?: typeof DefaultLogger) { super(); this.logger = logger || DefaultLogger;