mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
feat(packages/shared)!: switch to less resource-intensive logger
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
"consoleLogLevel": {
|
||||
"description": "The log level to print to console",
|
||||
"type": "string",
|
||||
"enum": ["error", "warn", "info", "verbose", "debug", "silly", "none"],
|
||||
"enum": ["error", "warn", "info", "log", "debug", "none"],
|
||||
"default": "info"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,18 @@ Amount of concurrent queues that can be run at a time.
|
||||
|
||||
Heartbeat interval for clients. See [**💓 Heartbeating**](./packets.md#💓-heartbeating).
|
||||
|
||||
### `config.debugLogsInProduction`
|
||||
### `config.consoleLogLevel`
|
||||
|
||||
Whether to print debug logs at all in production mode (when `NODE_ENV` is `production`).
|
||||
The level of logs to print to console. If the level is more important or equally important to set level, it will be forwarded to the console.
|
||||
|
||||
The possible levels (sorted by their importance descendingly) are:
|
||||
- `fatal`
|
||||
- `error`
|
||||
- `warn`
|
||||
- `info`
|
||||
- `log`
|
||||
- `trace`
|
||||
- `debug`
|
||||
|
||||
## ⏭️ What's next
|
||||
|
||||
|
||||
@@ -18,9 +18,8 @@ import { checkEnvironment, getConfig } from './utils/index.js'
|
||||
// Load config, init logger, check environment
|
||||
|
||||
const config = getConfig()
|
||||
const logger = createLogger('websocket-api', {
|
||||
level: config.consoleLogLevel === 'none' ? 'error' : config.consoleLogLevel,
|
||||
silent: config.consoleLogLevel === 'none',
|
||||
const logger = createLogger({
|
||||
level: config.consoleLogLevel === 'none' ? Infinity : config.consoleLogLevel,
|
||||
})
|
||||
|
||||
checkEnvironment(logger)
|
||||
@@ -32,7 +31,8 @@ const witClient = new Wit({
|
||||
accessToken: process.env['WIT_AI_TOKEN']!,
|
||||
})
|
||||
|
||||
process.on('beforeExit', () => tesseractWorker.terminate())
|
||||
logger.fatal('test')
|
||||
logger.error('test')
|
||||
|
||||
// Server logic
|
||||
|
||||
@@ -112,7 +112,7 @@ const server = fastify()
|
||||
|
||||
// Start the server
|
||||
|
||||
logger.debug(`Starting with these configurations: ${inspectObject(config)}`, )
|
||||
logger.debug(`Starting with these configurations: ${inspectObject(config)}`)
|
||||
|
||||
await server.listen({
|
||||
host: config.address ?? '0.0.0.0',
|
||||
|
||||
Reference in New Issue
Block a user