mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-06 22:26:45 +00:00
introduce logging context
This commit is contained in:
parent
9e24af646a
commit
544120a93e
@ -1,6 +1,6 @@
|
|||||||
import Dockerode from 'dockerode'
|
import Dockerode from 'dockerode'
|
||||||
import { ErrorRequestHandler } from 'express'
|
import { ErrorRequestHandler } from 'express'
|
||||||
import { LoggerService } from '../../../../../common'
|
import { logger } from '../../../../../common'
|
||||||
import {
|
import {
|
||||||
MOTHERSHIP_ADMIN_PASSWORD,
|
MOTHERSHIP_ADMIN_PASSWORD,
|
||||||
MOTHERSHIP_ADMIN_USERNAME,
|
MOTHERSHIP_ADMIN_USERNAME,
|
||||||
@ -18,8 +18,7 @@ import {
|
|||||||
} from '../../../../../services'
|
} from '../../../../../services'
|
||||||
|
|
||||||
export async function daemon() {
|
export async function daemon() {
|
||||||
const logger = LoggerService().create(`EdgeDaemonCommand`)
|
const { info, warn } = logger()
|
||||||
const { dbg, error, info, warn } = logger
|
|
||||||
info(`Starting`)
|
info(`Starting`)
|
||||||
|
|
||||||
const docker = new Dockerode()
|
const docker = new Dockerode()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../../../../common'
|
||||||
import { daemon } from './daemon'
|
import { daemon } from './daemon'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
@ -9,6 +10,7 @@ export const ServeCommand = () => {
|
|||||||
const cmd = new Command(`serve`)
|
const cmd = new Command(`serve`)
|
||||||
.description(`Run an edge daemon server`)
|
.description(`Run an edge daemon server`)
|
||||||
.action(async (options: Options) => {
|
.action(async (options: Options) => {
|
||||||
|
logger().context({ cli: 'edge:daemon:serve' })
|
||||||
await daemon()
|
await daemon()
|
||||||
})
|
})
|
||||||
return cmd
|
return cmd
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
import { FtpSrv } from 'ftp-srv'
|
import { FtpSrv } from 'ftp-srv'
|
||||||
import {
|
import {
|
||||||
LoggerService,
|
|
||||||
PocketBase,
|
PocketBase,
|
||||||
|
logger,
|
||||||
mergeConfig,
|
mergeConfig,
|
||||||
mkSingleton,
|
mkSingleton,
|
||||||
} from '../../../../../common'
|
} from '../../../../../common'
|
||||||
@ -31,13 +31,13 @@ export const ftpService = mkSingleton((config: Partial<FtpConfig> = {}) => {
|
|||||||
key: readFileSync(SSL_KEY()),
|
key: readFileSync(SSL_KEY()),
|
||||||
cert: readFileSync(SSL_CERT()),
|
cert: readFileSync(SSL_CERT()),
|
||||||
}
|
}
|
||||||
const _ftpServiceLogger = LoggerService().create('FtpService')
|
const _ftpServiceLogger = logger()
|
||||||
const { dbg, info } = _ftpServiceLogger
|
const { dbg, info } = _ftpServiceLogger
|
||||||
|
|
||||||
const ftpServer = new FtpSrv({
|
const ftpServer = new FtpSrv({
|
||||||
url: 'ftp://0.0.0.0:' + PH_FTP_PORT(),
|
url: 'ftp://0.0.0.0:' + PH_FTP_PORT(),
|
||||||
anonymous: false,
|
anonymous: false,
|
||||||
log: _ftpServiceLogger.create(`ftpServer`),
|
log: _ftpServiceLogger,
|
||||||
tls,
|
tls,
|
||||||
pasv_url: PH_FTP_PASV_IP(),
|
pasv_url: PH_FTP_PASV_IP(),
|
||||||
pasv_max: PH_FTP_PASV_PORT_MAX(),
|
pasv_max: PH_FTP_PASV_PORT_MAX(),
|
||||||
@ -60,7 +60,11 @@ export const ftpService = mkSingleton((config: Partial<FtpConfig> = {}) => {
|
|||||||
await client.collection('users').authWithPassword(username, password)
|
await client.collection('users').authWithPassword(username, password)
|
||||||
}
|
}
|
||||||
dbg(`Logged in`)
|
dbg(`Logged in`)
|
||||||
const fs = new PhFs(connection, client, _ftpServiceLogger)
|
const fs = new PhFs(
|
||||||
|
connection,
|
||||||
|
client,
|
||||||
|
_ftpServiceLogger.child(username).context({ ftpSession: Date.now() }),
|
||||||
|
)
|
||||||
resolve({ fs })
|
resolve({ fs })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject(new Error(`Invalid username or password`))
|
reject(new Error(`Invalid username or password`))
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { LoggerService } from '../../../../../common'
|
import { logger } from '../../../../../common'
|
||||||
import { MOTHERSHIP_URL, tryFetch } from '../../../../../core'
|
import {
|
||||||
|
MOTHERSHIP_URL,
|
||||||
|
tryFetch,
|
||||||
|
} from '../../../../../core'
|
||||||
import { ftpService } from '../FtpService'
|
import { ftpService } from '../FtpService'
|
||||||
|
|
||||||
export async function ftp() {
|
export async function ftp() {
|
||||||
const logger = LoggerService().create(`EdgeFtpCommand`)
|
const { info } = logger()
|
||||||
const { dbg, error, info, warn } = logger
|
|
||||||
info(`Starting`)
|
info(`Starting`)
|
||||||
|
|
||||||
await tryFetch(MOTHERSHIP_URL(`/api/health`), {})
|
await tryFetch(MOTHERSHIP_URL(`/api/health`), {})
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../../../../common'
|
||||||
import { ftp } from './ftp'
|
import { ftp } from './ftp'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
@ -9,6 +10,7 @@ export const ServeCommand = () => {
|
|||||||
const cmd = new Command(`serve`)
|
const cmd = new Command(`serve`)
|
||||||
.description(`Run an edge FTP server`)
|
.description(`Run an edge FTP server`)
|
||||||
.action(async (options: Options) => {
|
.action(async (options: Options) => {
|
||||||
|
logger().context({ cli: 'edge:ftp:serve' })
|
||||||
await ftp()
|
await ftp()
|
||||||
})
|
})
|
||||||
return cmd
|
return cmd
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../../../../common'
|
||||||
import { syslog } from './syslog'
|
import { syslog } from './syslog'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
@ -9,6 +10,7 @@ export const ServeCommand = () => {
|
|||||||
const cmd = new Command(`serve`)
|
const cmd = new Command(`serve`)
|
||||||
.description(`Run an edge syslog server`)
|
.description(`Run an edge syslog server`)
|
||||||
.action(async (options: Options) => {
|
.action(async (options: Options) => {
|
||||||
|
logger().context({ cli: 'edge:syslog:serve' })
|
||||||
await syslog()
|
await syslog()
|
||||||
})
|
})
|
||||||
return cmd
|
return cmd
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../../common'
|
||||||
import { firewall } from './firewall/server'
|
import { firewall } from './firewall/server'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
@ -9,6 +10,7 @@ export const ServeCommand = () => {
|
|||||||
const cmd = new Command(`serve`)
|
const cmd = new Command(`serve`)
|
||||||
.description(`Serve the root firewall`)
|
.description(`Serve the root firewall`)
|
||||||
.action(async (options: Options) => {
|
.action(async (options: Options) => {
|
||||||
|
logger().context({ cli: 'firewall:serve' })
|
||||||
await firewall()
|
await firewall()
|
||||||
})
|
})
|
||||||
return cmd
|
return cmd
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../../common'
|
||||||
import { ServeCommand } from './ServeCommand'
|
import { ServeCommand } from './ServeCommand'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
@ -10,6 +11,7 @@ export const FirewallCommand = () => {
|
|||||||
.description(`Root firewall commands`)
|
.description(`Root firewall commands`)
|
||||||
.addCommand(ServeCommand())
|
.addCommand(ServeCommand())
|
||||||
.action(() => {
|
.action(() => {
|
||||||
|
logger().context({ cli: 'firewall' })
|
||||||
cmd.help()
|
cmd.help()
|
||||||
})
|
})
|
||||||
return cmd
|
return cmd
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
import { LoggerService } from '../../../../core'
|
import { logger } from '../../../../core'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
debug: boolean
|
debug: boolean
|
||||||
@ -11,8 +11,8 @@ export const HealthCommand = () => {
|
|||||||
new Command(`check`)
|
new Command(`check`)
|
||||||
.description(`Perform a health check on the PocketHost system`)
|
.description(`Perform a health check on the PocketHost system`)
|
||||||
.action(async (options: Options) => {
|
.action(async (options: Options) => {
|
||||||
const logger = LoggerService().create(`HealthCommand`)
|
logger().context({ cli: 'health:check' })
|
||||||
const { dbg, error, info, warn } = logger
|
const { dbg, error, info, warn } = logger()
|
||||||
info(`Starting`)
|
info(`Starting`)
|
||||||
const { checkHealth } = await import(`./checkHealth`)
|
const { checkHealth } = await import(`./checkHealth`)
|
||||||
await checkHealth()
|
await checkHealth()
|
||||||
@ -24,8 +24,8 @@ export const HealthCommand = () => {
|
|||||||
`Compact SQLite databases by removing old SHM and WAL files`,
|
`Compact SQLite databases by removing old SHM and WAL files`,
|
||||||
)
|
)
|
||||||
.action(async (options: Options) => {
|
.action(async (options: Options) => {
|
||||||
const logger = LoggerService().create(`HealthCommand`)
|
logger().context({ cli: 'health:compact' })
|
||||||
const { dbg, error, info, warn } = logger
|
const { dbg, error, info, warn } = logger()
|
||||||
info(`Starting`)
|
info(`Starting`)
|
||||||
const { compact } = await import(`./compact`)
|
const { compact } = await import(`./compact`)
|
||||||
await compact()
|
await compact()
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../../common'
|
||||||
import { schema } from './schema'
|
import { schema } from './schema'
|
||||||
|
|
||||||
export const SchemaCommand = () => {
|
export const SchemaCommand = () => {
|
||||||
const cmd = new Command(`schema`)
|
const cmd = new Command(`schema`)
|
||||||
.description(`Create snapshot of the current PocketHost mothership schema`)
|
.description(`Create snapshot of the current PocketHost mothership schema`)
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
|
logger().context({ cli: 'mothership:schema' })
|
||||||
await schema()
|
await schema()
|
||||||
})
|
})
|
||||||
return cmd
|
return cmd
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../../common'
|
||||||
import { mothership } from './mothership'
|
import { mothership } from './mothership'
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
@ -10,6 +11,7 @@ export const ServeCommand = () => {
|
|||||||
.description(`Run the PocketHost mothership`)
|
.description(`Run the PocketHost mothership`)
|
||||||
.option(`--isolate`, `Use Docker for process isolation.`, false)
|
.option(`--isolate`, `Use Docker for process isolation.`, false)
|
||||||
.action(async (options: Options) => {
|
.action(async (options: Options) => {
|
||||||
|
logger().context({ cli: 'mothership:serve' })
|
||||||
console.log({ options })
|
console.log({ options })
|
||||||
await mothership(options)
|
await mothership(options)
|
||||||
})
|
})
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../../common'
|
||||||
import { freshenPocketbaseVersions } from './freshenPocketbaseVersions'
|
import { freshenPocketbaseVersions } from './freshenPocketbaseVersions'
|
||||||
|
|
||||||
export const UpdateCommand = () => {
|
export const UpdateCommand = () => {
|
||||||
const cmd = new Command(`update`)
|
const cmd = new Command(`update`)
|
||||||
.description(`Update PocketBase versions`)
|
.description(`Update PocketBase versions`)
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
|
logger().context({ cli: 'pocketbase:update' })
|
||||||
|
const { info } = logger()
|
||||||
await freshenPocketbaseVersions()
|
await freshenPocketbaseVersions()
|
||||||
|
info('PocketBase versions updated')
|
||||||
})
|
})
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ export const SendMailCommand = () =>
|
|||||||
.option('--confirm', `Really send messages`, false)
|
.option('--confirm', `Really send messages`, false)
|
||||||
|
|
||||||
.action(async (messageId, { limit, confirm }) => {
|
.action(async (messageId, { limit, confirm }) => {
|
||||||
const { dbg, info } = logger().create(`mail.ts`)
|
logger().context({ cli: 'sendmail' })
|
||||||
|
const { dbg, info } = logger()
|
||||||
|
|
||||||
function interpolateString(
|
function interpolateString(
|
||||||
template: string,
|
template: string,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
import { logger } from '../../../common'
|
||||||
import { LoggerService } from '../../../common'
|
import { LoggerService } from '../../../common'
|
||||||
import { daemon } from '../EdgeCommand/DaemonCommand/ServeCommand/daemon'
|
import { daemon } from '../EdgeCommand/DaemonCommand/ServeCommand/daemon'
|
||||||
import { syslog } from '../EdgeCommand/SyslogCommand/ServeCommand/syslog'
|
import { syslog } from '../EdgeCommand/SyslogCommand/ServeCommand/syslog'
|
||||||
@ -13,8 +14,8 @@ export const ServeCommand = () => {
|
|||||||
const cmd = new Command(`serve`)
|
const cmd = new Command(`serve`)
|
||||||
.description(`Run the entire PocketHost stack`)
|
.description(`Run the entire PocketHost stack`)
|
||||||
.action(async (options: Options) => {
|
.action(async (options: Options) => {
|
||||||
const logger = LoggerService().create(`ServeCommand`)
|
logger().context({ cli: 'serve' })
|
||||||
const { dbg, error, info, warn } = logger
|
const { dbg, error, info, warn } = logger()
|
||||||
info(`Starting`)
|
info(`Starting`)
|
||||||
|
|
||||||
await syslog()
|
await syslog()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { program } from 'commander'
|
import { program } from 'commander'
|
||||||
import EventSource from 'eventsource'
|
import EventSource from 'eventsource'
|
||||||
import { LogLevelName, LoggerService } from '../../core'
|
import { LogLevelName, gracefulExit, logger } from '../../core'
|
||||||
import { version } from '../../package.json'
|
import { version } from '../../package.json'
|
||||||
import { EdgeCommand } from './commands/EdgeCommand'
|
import { EdgeCommand } from './commands/EdgeCommand'
|
||||||
import { FirewallCommand } from './commands/FirewallCommand'
|
import { FirewallCommand } from './commands/FirewallCommand'
|
||||||
@ -11,7 +11,7 @@ import { MothershipCommand } from './commands/MothershipCommand'
|
|||||||
import { PocketBaseCommand } from './commands/PocketBaseCommand'
|
import { PocketBaseCommand } from './commands/PocketBaseCommand'
|
||||||
import { MailCommand } from './commands/SendMailCommand'
|
import { MailCommand } from './commands/SendMailCommand'
|
||||||
import { ServeCommand } from './commands/ServeCommand'
|
import { ServeCommand } from './commands/ServeCommand'
|
||||||
import './ioc'
|
import { initIoc } from './ioc'
|
||||||
|
|
||||||
export type GlobalOptions = {
|
export type GlobalOptions = {
|
||||||
logLevel?: LogLevelName
|
logLevel?: LogLevelName
|
||||||
@ -22,6 +22,7 @@ export type GlobalOptions = {
|
|||||||
global.EventSource = EventSource
|
global.EventSource = EventSource
|
||||||
|
|
||||||
export const main = async () => {
|
export const main = async () => {
|
||||||
|
await initIoc()
|
||||||
program.name('pockethost').description('Multitenant PocketBase hosting')
|
program.name('pockethost').description('Multitenant PocketBase hosting')
|
||||||
|
|
||||||
program
|
program
|
||||||
@ -33,13 +34,15 @@ export const main = async () => {
|
|||||||
.addCommand(ServeCommand())
|
.addCommand(ServeCommand())
|
||||||
.addCommand(PocketBaseCommand())
|
.addCommand(PocketBaseCommand())
|
||||||
.action(async () => {
|
.action(async () => {
|
||||||
const { info, dbg } = LoggerService()
|
logger().context({ cli: 'main' })
|
||||||
|
const { info, dbg } = logger()
|
||||||
info('PocketHost CLI')
|
info('PocketHost CLI')
|
||||||
info(`Version: ${version}`, { version })
|
info(`Version: ${version}`, { version })
|
||||||
program.help()
|
program.help()
|
||||||
})
|
})
|
||||||
|
|
||||||
await program.parseAsync()
|
await program.parseAsync()
|
||||||
|
await gracefulExit()
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
|
import { version } from '../../package.json'
|
||||||
import { ioc } from '../common'
|
import { ioc } from '../common'
|
||||||
import { RegisterEnvSettingsService } from '../constants'
|
import { RegisterEnvSettingsService } from '../constants'
|
||||||
import { WinstonLoggerService } from '../core/winston'
|
import { WinstonLoggerService } from '../core/winston'
|
||||||
import { GobotService } from '../services/GobotService'
|
import { GobotService } from '../services/GobotService'
|
||||||
|
|
||||||
ioc('logger', WinstonLoggerService({}))
|
export const initIoc = async () => {
|
||||||
|
const logger = await WinstonLoggerService({})
|
||||||
RegisterEnvSettingsService()
|
ioc('logger', logger.context('ph_version', version))
|
||||||
GobotService({})
|
RegisterEnvSettingsService()
|
||||||
|
GobotService({})
|
||||||
|
}
|
||||||
|
@ -66,6 +66,10 @@ export function ConsoleLogger(
|
|||||||
console.log('Breadcrumb:', s)
|
console.log('Breadcrumb:', s)
|
||||||
return logger
|
return logger
|
||||||
},
|
},
|
||||||
|
context(name: string | object, value?: string | number): Logger {
|
||||||
|
console.log('Context:', name, value)
|
||||||
|
return logger
|
||||||
|
},
|
||||||
abort(...args: any[]): never {
|
abort(...args: any[]): never {
|
||||||
log(LogLevelName.Abort, ...args)
|
log(LogLevelName.Abort, ...args)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
|
@ -60,6 +60,7 @@ export type Logger = {
|
|||||||
trace: (...args: any[]) => void
|
trace: (...args: any[]) => void
|
||||||
debug: (...args: any[]) => void
|
debug: (...args: any[]) => void
|
||||||
breadcrumb: (s: object) => Logger
|
breadcrumb: (s: object) => Logger
|
||||||
|
context: (name: string | object, value?: string | number) => Logger
|
||||||
abort: (...args: any[]) => never
|
abort: (...args: any[]) => never
|
||||||
shutdown: () => void
|
shutdown: () => void
|
||||||
setLevel: (level: LogLevelName) => void
|
setLevel: (level: LogLevelName) => void
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { inspect } from 'node:util'
|
import { inspect } from 'node:util'
|
||||||
import winston from 'winston'
|
import winston from 'winston'
|
||||||
|
import { exitHook } from '..'
|
||||||
import { Logger, mkSingleton } from '../common'
|
import { Logger, mkSingleton } from '../common'
|
||||||
import { DEBUG, DISCORD_ALERT_CHANNEL_URL } from '../constants'
|
import { DEBUG, DISCORD_ALERT_CHANNEL_URL } from '../constants'
|
||||||
import { DiscordTransport } from './DiscordTransport'
|
import { DiscordTransport } from './DiscordTransport'
|
||||||
@ -8,11 +9,15 @@ const format = winston.format.combine(
|
|||||||
winston.format.colorize(),
|
winston.format.colorize(),
|
||||||
winston.format.printf(({ level, message, timestamp, ...meta }) => {
|
winston.format.printf(({ level, message, timestamp, ...meta }) => {
|
||||||
const final: string[] = []
|
const final: string[] = []
|
||||||
message.forEach((m: string) => {
|
;[...message, meta].forEach((m: string) => {
|
||||||
if (typeof m === 'string' && !!m.match(/\n/)) {
|
if (typeof m === 'string' && !!m.match(/\n/)) {
|
||||||
final.push(...m.split(/\n/))
|
final.push(...m.split(/\n/))
|
||||||
} else if (typeof m === 'object') {
|
} else if (typeof m === 'object') {
|
||||||
final.push(inspect(m, { depth: null }))
|
// Filter out Symbol properties and inspect the object
|
||||||
|
const filtered = Object.fromEntries(
|
||||||
|
Object.entries(m).filter(([key]) => typeof key === 'string'),
|
||||||
|
)
|
||||||
|
final.push(inspect(filtered, { depth: null }))
|
||||||
} else {
|
} else {
|
||||||
final.push(m)
|
final.push(m)
|
||||||
}
|
}
|
||||||
@ -72,6 +77,11 @@ export const WinstonLoggerService = mkSingleton<{}, Logger>(() => {
|
|||||||
})
|
})
|
||||||
logger.exitOnError = true
|
logger.exitOnError = true
|
||||||
|
|
||||||
|
exitHook(() => {
|
||||||
|
// console.log('Closing Winston logger')
|
||||||
|
logger.close()
|
||||||
|
})
|
||||||
|
|
||||||
{
|
{
|
||||||
const url = DISCORD_ALERT_CHANNEL_URL()
|
const url = DISCORD_ALERT_CHANNEL_URL()
|
||||||
if (url) {
|
if (url) {
|
||||||
@ -97,8 +107,20 @@ export const WinstonLoggerService = mkSingleton<{}, Logger>(() => {
|
|||||||
Object.assign(logger.defaultMeta, s)
|
Object.assign(logger.defaultMeta, s)
|
||||||
return api
|
return api
|
||||||
},
|
},
|
||||||
|
context: (name: string | object, value?: string | number) => {
|
||||||
|
if (typeof name === 'string') {
|
||||||
|
if (value !== undefined) {
|
||||||
|
logger.defaultMeta[name] = value
|
||||||
|
} else {
|
||||||
|
delete logger.defaultMeta[name]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.assign(logger.defaultMeta, name)
|
||||||
|
}
|
||||||
|
return api
|
||||||
|
},
|
||||||
shutdown: () => {},
|
shutdown: () => {},
|
||||||
child: (name) => createApi(logger.child({ name })),
|
child: (name) => api.create(name),
|
||||||
abort: (...args) => {
|
abort: (...args) => {
|
||||||
logger.error(args)
|
logger.error(args)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user