mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-21 02:03:57 +00:00
fix(packages/shared): fix weird log dates and clean up imports
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
import { colorConsole, console as uncoloredConsole, Tracer } from 'tracer'
|
||||
import { Chalk, supportsColor, supportsColorStderr } from 'chalk'
|
||||
import { console as uncoloredConsole, Tracer, colorConsole } from 'tracer'
|
||||
|
||||
const chalk = new Chalk()
|
||||
const DefaultConfig = {
|
||||
dateformat: 'DD/MM/YYYY HH:mm:ss.sss Z',
|
||||
dateformat: 'dd/mm/yyyy HH:mm:ss.sss Z',
|
||||
format: [
|
||||
'{{message}}',
|
||||
{
|
||||
error: `${chalk.bgRedBright.whiteBright(' ERROR ')} {{message}}\n${chalk.gray(
|
||||
'{{stack}}',
|
||||
)}`,
|
||||
error: `${chalk.bgRedBright.whiteBright(' ERROR ')} {{message}}\n${chalk.gray('{{stack}}')}`,
|
||||
debug: chalk.gray('DEBUG: {{message}}\n{{stack}}'),
|
||||
warn: `${chalk.bgYellowBright.whiteBright(' WARN ')} ${chalk.yellowBright('{{message}}')}\n${chalk.gray(
|
||||
'{{stack}}',
|
||||
@@ -26,7 +24,7 @@ const DefaultConfig = {
|
||||
filters: [],
|
||||
} satisfies Tracer.LoggerConfig
|
||||
|
||||
export function createLogger(config: Omit<Tracer.LoggerConfig, keyof typeof DefaultConfig>) {
|
||||
export function createLogger(config?: Omit<Tracer.LoggerConfig, keyof typeof DefaultConfig>) {
|
||||
const combinedConfig = { ...DefaultConfig, ...config }
|
||||
|
||||
if (
|
||||
@@ -37,7 +35,7 @@ export function createLogger(config: Omit<Tracer.LoggerConfig, keyof typeof Defa
|
||||
supportsColorStderr.hasBasic
|
||||
)
|
||||
return colorConsole(combinedConfig)
|
||||
else return uncoloredConsole(combinedConfig)
|
||||
return uncoloredConsole(combinedConfig)
|
||||
}
|
||||
|
||||
export type Logger = ReturnType<typeof createLogger>
|
||||
|
||||
Reference in New Issue
Block a user