From 79b815a57dc9d66b7a99612bf3fc393c1f1487b6 Mon Sep 17 00:00:00 2001 From: "Jason C. Leach" Date: Wed, 10 Jan 2024 15:52:17 -0800 Subject: [PATCH] fix: eslint issues Signed-off-by: Jason C. Leach --- packages/remote-logs/src/logger.ts | 32 ++++++++++++++------------ packages/remote-logs/src/transports.ts | 6 +++-- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/packages/remote-logs/src/logger.ts b/packages/remote-logs/src/logger.ts index 76dfe46aff..24e311a143 100644 --- a/packages/remote-logs/src/logger.ts +++ b/packages/remote-logs/src/logger.ts @@ -1,6 +1,7 @@ import { BaseLogger } from '@aries-framework/core' -import { logger, consoleTransport } from 'react-native-logs' import { DeviceEventEmitter, EmitterSubscription } from 'react-native' +import { logger, consoleTransport } from 'react-native-logs' + import { RemoteLoggerOptions, lokiTransport } from './transports' export enum RemoteLoggerEventTypes { @@ -15,6 +16,7 @@ export class RemoteLogger extends BaseLogger { private lokiLabels: Record private remoteLoggingAutoDisableTimer: ReturnType | undefined private eventListener: EmitterSubscription | undefined + // eslint-disable-next-line @typescript-eslint/no-explicit-any private log: any private config = { levels: { @@ -107,31 +109,31 @@ export class RemoteLogger extends BaseLogger { this.eventListener = undefined } - public test(message: string, data?: Record | undefined): void { - this.log.test({ message, data }) + public test(message: string, data?: object | undefined): void { + this.log?.test({ message, data }) } - public trace(message: string, data?: Record | undefined): void { - this.log.trace({ message, data }) + public trace(message: string, data?: object | undefined): void { + this.log?.trace({ message, data }) } - public debug(message: string, data?: Record | undefined): void { - this.log.debug({ message, data }) + public debug(message: string, data?: object | undefined): void { + this.log?.debug({ message, data }) } - public info(message: string, data?: Record | undefined): void { - this.log.info({ message, data }) + public info(message: string, data?: object | undefined): void { + this.log?.info({ message, data }) } - public warn(message: string, data?: Record | undefined): void { - this.log.warn({ message, data }) + public warn(message: string, data?: object | undefined): void { + this.log?.warn({ message, data }) } - public error(message: string, data?: Record | undefined): void { - this.log.error({ message, data }) + public error(message: string, data?: object | undefined): void { + this.log?.error({ message, data }) } - public fatal(message: string, data?: Record | undefined): void { - this.log.fatal({ message, data }) + public fatal(message: string, data?: object | undefined): void { + this.log?.fatal({ message, data }) } } diff --git a/packages/remote-logs/src/transports.ts b/packages/remote-logs/src/transports.ts index 0f3746c81a..407be7d41d 100644 --- a/packages/remote-logs/src/transports.ts +++ b/packages/remote-logs/src/transports.ts @@ -8,7 +8,9 @@ export interface RemoteLoggerOptions { } export type LokiTransportProps = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any msg: any + // eslint-disable-next-line @typescript-eslint/no-explicit-any rawMsg: any level: { severity: number @@ -57,10 +59,10 @@ export const lokiTransport: transportFunctionType = (props: LokiTransportProps) .post(lokiUrl, payload) .then((res) => { if (res.status !== 204) { - console.warn(`Expected Loki to return 204, received ${res.status}`) + throw new Error(`Expected Loki to return 204, received ${res.status}`) } }) .catch((error) => { - console.error(`Error while sending to Loki, ${error}`) + throw new Error(`Error while sending to Loki, ${error}`) }) }