chore: remove PbClient logger context

This commit is contained in:
Ben Allfree 2023-10-21 03:22:19 -07:00
parent 39a45b0aec
commit c2dc918ad4
3 changed files with 6 additions and 6 deletions

View File

@ -66,7 +66,7 @@ export const ftpService = mkSingleton((config: FtpConfig) => {
'login',
async ({ connection, username, password }, resolve, reject) => {
const url = (await clientService()).client.url
const client = createPbClient(url, _ftpServiceLogger)
const client = createPbClient(url)
try {
await client.client
.collection('users')

View File

@ -1,5 +1,5 @@
import { mkInstanceDataPath, PUBLIC_MOTHERSHIP_NAME } from '$constants'
import { Logger, safeCatch } from '@pockethost/common'
import { Logger, LoggerService, safeCatch } from '@pockethost/common'
import { Knex } from 'knex'
import { default as PocketBase, default as pocketbaseEs } from 'pocketbase'
import { createInstanceMixin } from './InstanceMIxin'
@ -11,8 +11,8 @@ export type PocketbaseClientApi = ReturnType<typeof createPbClient>
export type MixinContext = { client: pocketbaseEs; rawDb: Knex; logger: Logger }
export const createPbClient = (url: string, logger: Logger) => {
const _clientLogger = logger.create('PbClient')
export const createPbClient = (url: string) => {
const _clientLogger = LoggerService().create('PbClient')
const { info } = _clientLogger
info(`Initializing client: ${url}`)

View File

@ -11,7 +11,7 @@ export const clientService = mkSingleton(async (cfg: ClientServiceConfig) => {
const { url, username, password } = cfg
const _clientLogger = LoggerService().create(`client singleton`)
const { dbg, error } = _clientLogger
const client = createPbClient(url, _clientLogger)
const client = createPbClient(url)
try {
await client.adminAuthViaEmail(username, password)
@ -25,7 +25,7 @@ export const clientService = mkSingleton(async (cfg: ClientServiceConfig) => {
dbg(`Logged in`)
} catch (e) {
error(`CANNOT AUTHENTICATE TO ${url}`)
process.exit(-1)
throw e
}
}