-- ROBLOX deviation END


local chalk = require(Packages.ChalkLua)

local JestUtil = require(Packages.JestUtil)
local clearLine = JestUtil.clearLine
local formatTime = JestUtil.formatTime

local typesModule = require(CurrentModule.types)
type LogCounters = typesModule.LogCounters
type LogMessage = typesModule.LogMessage
type LogTimers = typesModule.LogTimers
type LogType = typesModule.LogType
type InspectOptions = typesModule.InspectOptions

type Formatter = (type: LogType, message: LogMessage) -> string

export type CustomConsole = {
	Console: any,
	assert: (self: CustomConsole, value: unknown, message: (string | Error)?) -> (),
	count: (self: CustomConsole, label: string?) -> (),
	countReset: (self: CustomConsole, label: string?) -> (),
	debug: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	dir: (self: CustomConsole, firstArg: unknown, options: InspectOptions?) -> (),
	dirxml: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	error: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	group: (self: CustomConsole, title: string?, ...any) -> (),
	groupCollapsed: (self: CustomConsole, title: string?, ...any) -> (),
	groupEnd: (self: CustomConsole) -> (),
	info: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	log: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	time: (self: CustomConsole, label: string?) -> (),
	timeEnd: (self: CustomConsole, label: string?) -> (),
	timeLog: (self: CustomConsole, label: string?, ...any) -> (),
	warn: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	getBuffer: () -> nil,
}

type CustomConsolePrivate = CustomConsole & {
	_log: (self: CustomConsole, type: LogType, message: LogMessage) -> (),
	_logError: (self: CustomConsole, type: LogType, message: LogMessage) -> (),
	_groupDepth: number,
	_counters: LogCounters,
	_timers: LogTimers,
	_stdout: Writeable,
	_stderr: Writeable,
	_formatBuffer: Formatter,
	_write: (self: CustomConsole, type: string, value: string) -> (),
}
