Skip to content

editable-console


editable-console / EditableLog

Class: EditableLog

Defined in: EditableLog.ts:9

Represents an individual editable log entry.

Constructors

Constructor

new EditableLog(console, type, messages): EditableLog

Defined in: EditableLog.ts:26

Creates an instance of EditableLog.

Parameters

console

EditableConsole

The parent console.

type

LogType

The type of log ('info', 'warn', or 'error').

messages

AnyMessage[]

The messages to include in the log.

Returns

EditableLog

Properties

console

console: EditableConsole

Defined in: EditableLog.ts:11

The parent console instance.


messages

messages: EditableMessage[] = []

Defined in: EditableLog.ts:17

Array of editable messages contained in this log entry.


type

type: LogType = 'info'

Defined in: EditableLog.ts:14

The type of log entry.

Accessors

colorFn

Get Signature

get colorFn(): (text) => string

Defined in: EditableLog.ts:98

Gets the chalk color function based on the log type.

Returns

Function

A function that applies the appropriate color to the text.

Parameters
text

string

Returns

string

Methods

edit()

edit(...messages): void

Defined in: EditableLog.ts:81

Edits the current log with new messages.

Parameters

messages

...AnyMessage[]

The new messages for the log.

Returns

void


remove()

remove(): void

Defined in: EditableLog.ts:89

Removes this log entry from its parent console.

Returns

void


removeMessage()

removeMessage(message): void

Defined in: EditableLog.ts:63

Removes a specific message from this log.

Parameters

message

The message or its index to remove.

number | EditableMessage

Returns

void


toString()

toString(): string

Defined in: EditableLog.ts:111

Converts this log entry to a string representation.

Returns

string

The string representation of the log.