Skip to content

Commit

Permalink
fix: eslint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Jason C. Leach <[email protected]>
  • Loading branch information
jleach committed Jan 10, 2024
1 parent db72744 commit 79b815a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
32 changes: 17 additions & 15 deletions packages/remote-logs/src/logger.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -15,6 +16,7 @@ export class RemoteLogger extends BaseLogger {
private lokiLabels: Record<string, string>
private remoteLoggingAutoDisableTimer: ReturnType<typeof setTimeout> | undefined
private eventListener: EmitterSubscription | undefined
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private log: any
private config = {
levels: {
Expand Down Expand Up @@ -107,31 +109,31 @@ export class RemoteLogger extends BaseLogger {
this.eventListener = undefined
}

public test(message: string, data?: Record<string, any> | 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<string, any> | 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<string, any> | 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<string, any> | 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<string, any> | 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<string, any> | 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<string, any> | undefined): void {
this.log.fatal({ message, data })
public fatal(message: string, data?: object | undefined): void {
this.log?.fatal({ message, data })
}
}
6 changes: 4 additions & 2 deletions packages/remote-logs/src/transports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}`)
})
}

0 comments on commit 79b815a

Please sign in to comment.